Hi,
Can I first say thanks to all who read my newb questions and helped me out, much appreciated.
Quick pyqt question:
mywindow has a button on it. I want to run the clicked_function when clicked. This works
QtCore.
QObject.
connect(mywindow.
somebutton, QtCore.
SIGNAL("clicked()"), clicked_function
)
QtCore.QObject.connect(mywindow.somebutton, QtCore.SIGNAL("clicked()"), clicked_function)
To copy to clipboard, switch view to plain text mode
But if I want to click the button and pass 'foo' to the clicked_function, I thought I would be able to use
QtCore.
QObject.
connect(mywindow.
somebutton, QtCore.
SIGNAL("clicked()"), clicked_function
('foo'))
QtCore.QObject.connect(mywindow.somebutton, QtCore.SIGNAL("clicked()"), clicked_function('foo'))
To copy to clipboard, switch view to plain text mode
This brings up an 'argument of incorrect type' error. So how can I pass a value to the function? I thought I might try...
QtCore.
QObject.
connect(mywindow.
somebutton, QtCore.
SIGNAL("clicked()"), pre_clicked_function
)
def pre_clicked_function():
clicked_function('foo')
QtCore.QObject.connect(mywindow.somebutton, QtCore.SIGNAL("clicked()"), pre_clicked_function)
def pre_clicked_function():
clicked_function('foo')
To copy to clipboard, switch view to plain text mode
But this is far from streamlined! Any better ideas?
Bookmarks