Here is what is meant by programatically change. And this is what I mean by using the signals. I don't know what widgets your actually using, but if you can't find signals that are only emitted when you want, then you'll have have to hand the signals differently.
(I beleive there has been some other suggestions.) As a final option you could change the event handlers. mbs On Wed, 2009-02-04 at 21:11 +0100, Knapp wrote: > On Wed, Feb 4, 2009 at 5:40 PM, Matt Smith <mel...@orangepalantir.org> wrote: > > Have you noticed that QLineEdit emits a signal textEdited which is not > > emitted when the text is changed with setText. > > > > http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qlineedit.html#textEdited > > > > and spin boxes emit the following > > > > http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qabstractspinbox.html#editingFinished > > > > so that might not happen if you set the value programmaticaly. > > Thanks very much for the help. I don't fully understand though. What > do you mean by programmatically and which value do you mean? I am very > new to all this. > > >
#!/usr/bin/env python """ test program """ from PyQt4 import QtGui,QtCore class TestWidget(QtGui.QWidget): def __init__(self,parent=None): QtGui.QWidget.__init__(self,parent) layout = QtGui.QVBoxLayout() self.labelA = QtGui.QLineEdit(self) self.labelB = QtGui.QSpinBox(self) self.connect(self.labelB,QtCore.SIGNAL("editingFinished()"),self.programaticallyChangeA) self.connect(self.labelA,QtCore.SIGNAL("textChanged( QString )"),self.programaticallyChangeB) layout.addWidget(self.labelA) layout.addWidget(self.labelB) self.setLayout(layout) def programaticallyChangeB(self,text): try: self.labelB.setValue(int(text)) except: pass def programaticallyChangeA(self): try: self.labelA.setText(str(self.labelB.value())) except: pass app = QtGui.QApplication([]) widge = TestWidget() widge.show() app.exec_()
_______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt