I have two programs both with a QTableWidget. I want to synchronize the tables over network automatically. I have no idea how to do this. I have used pyqt with socket it dosen't work. I have read a lot about simple chat application like this. I think that is not the way I need.
My program without any network code:
import sys
from PyQt4 import QtGui, QtCore
class Window(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
# Table
header = ["Name", "Date", "Club"]
self.Table = QtGui.QTableWidget(0, len(header))
self.Table.setHorizontalHeaderLabels(header)
self.Table.resizeColumnsToContents()
# Layout
layout = QtGui.QGridLayout()
layout.addWidget(self.Table)
self.tab_widget = QtGui.QTabWidget()
self.tab_widget.updatesEnabled()
tabs = [u"Overview"]
for i,d in enumerate(tabs):
widget = QtGui.QWidget()
self.tab_widget.addTab(widget, d)
print i, d
if i == 0:
widget.setLayout(layout)
self.setCentralWidget(self.tab_widget)
self.show()
data = ["Name1", "Monday", "Club1"]
self.Table.insertRow(0)
# insert Data
for i in range(len(data)):
t = QtGui.QTableWidgetItem(data[i].decode("utf8"))
self.Table.setItem(0, i, t)
self.Table.resizeColumnsToContents()
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
prog = Window()
prog.show()
sys.exit(app.exec_())