-
Notifications
You must be signed in to change notification settings - Fork 0
Events and Buttons
http://www.tutorialspoint.com/pyqt/pyqt_signals_and_slots.htm
Again, QtGui needs to be replaced with QtWidgets.
SIGNAL is not supported in Qt5. Looking for an equivalent method. (Looks like 'use QAction instead')
Python 3 doesn't like "print 'stuff'" lines. Using "print('stuff')" instead.
This tutorial added a couple of elements: dialogs, push buttons and events.
First, rather than using a generic 'QWidget', this script is using a 'QDialog' child for the window. They appear functionally identical, but I'm sure the devil's in the details. In both cases, the geometry and title are set, and controls (QObject-s) are added and configured, prior to a "show" call.
While we saw a 'QLabel(myWidget)' previously, this script uses a 'QPushButton(myWindow)'. The argument is obviously the object to attach the control to. The controls then are move()'ed and have a setText(msg). The new piece here is the 'b1.clicked.connect(fName)', which attaches a callback to the specified method, when the control is clicked.
Digging around a little, it looks like obj.act.connect(...) can take a number of inputs, including a 'QAction' object, which should be explored later, knowing these tutorials.