Let's learn how to make widgets respond to a particular user action, such as a button click.
Download the file
AudioPlayerDialog.py
from the Packt website. It defines the classAudioPlayerDialog
.We will now review the method that connects class methods to the emitted signals. These signals are generated whenever a particular 'event' occurs.
1 def _connect(self): 2 """ 3 Connect slots with signals. 4 """ 5 self.connect(self._dialog.fileOpenAction, 6 SIGNAL("triggered()"), 7 self._openFileDialog) 8 9 self.connect(self._dialog.fileExitAction, 10 SIGNAL("triggered()"), 11 self.close) 12 13 self.connect(self._dialog.menuAudioEffects, 14 SIGNAL("triggered(QAction*)"), 15 self._changeAudioEffects) 16 17 self.connect(self._dialog.playToolButton, 18 SIGNAL("clicked()"), 19 self._playMedia...