Hello !

If i understand well what you want to do, here is a small recipe :
http://code.activestate.com/recipes/52549-curry-associating-parameters-with-a-function/

Regards,

2011/3/6 Aaron Richiger <[email protected]>:
> Hello!
>
> I just wrote a little program that implements what you wanted if I
> understood you correctly. Try it out writing some text in the TextEdits.
> I usually get the sender this way if I need them. Have a nice evening!
> Aaron
>
>
>
> from PySide import QtGui
> import sys
>
> class MyWidget(QtGui.QWidget):
>
>    def __init__(self):
>        QtGui.QWidget.__init__(self)
>        grid = QtGui.QGridLayout(self)
>        self.te_left = QtGui.QTextEdit(self)
>        self.te_right = QtGui.QTextEdit(self)
>        self.lb_left = QtGui.QLabel(self)
>        self.lb_right = QtGui.QLabel(self)
>        self.lb_left.setText('0')
>        self.lb_right.setText('0')
>        grid.addWidget(self.te_left, 0, 0)
>        grid.addWidget(self.te_right, 0 , 1)
>        grid.addWidget(self.lb_left, 1, 0)
>        grid.addWidget(self.lb_right, 1 , 1)
>
>  self.te_left.cursorPositionChanged.connect(self.displayCursorPosition)
>
>  self.te_right.cursorPositionChanged.connect(self.displayCursorPosition)
>
>
>    def displayCursorPosition(self):
>        if self.sender() == self.te_left:
>            self.lb_left.setText(str(self.sender().textCursor().position()))
>        else:
>            self.lb_right.setText(str(self.sender().textCursor().position()))
>
> if __name__ == '__main__':
>    app = QtGui.QApplication(sys.argv)
>    mw = MyWidget()
>    mw.show()
>    sys.exit(app.exec_())
> _______________________________________________
> PySide mailing list
> [email protected]
> http://lists.pyside.org/listinfo/pyside
>



-- 
Benoît HERVIER, Khertan Software - http://khertan.net/
_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside

Reply via email to