May 2019
Intermediate to advanced
542 pages
13h 37m
English
Our last callback is the simplest of all, and it looks like this:
def check_delete_btn(self): self.del_button.setDisabled( self.event_list.currentRow() == -1)
This method simply checks whether there is no event currently selected in the event list widget, and it enables or disables the delete button accordingly.
Back in __init__(), let's connect to this callback:
self.event_list.itemSelectionChanged.connect( self.check_delete_btn) self.check_delete_btn()
We're connecting this callback to the itemSelectionChanged signal. Note that we've already connected that signal to another slot as well. Signals can be connected to any number of slots without a problem. We also call the method directly, so that the del_button ...
Read now
Unlock full access