May 2019
Intermediate to advanced
542 pages
13h 37m
English
Before we create the actual form, we're going to simplify our code slightly by creating some custom button classes: a ColorButton class for setting colors, a FontButton class for setting fonts, and an ImageFileButton class for selecting images.
The ColorButton class begins like this:
class ColorButton(qtw.QPushButton): changed = qtc.pyqtSignal() def __init__(self, default_color, changed=None): super().__init__() self.set_color(qtg.QColor(default_color)) self.clicked.connect(self.on_click) if changed: self.changed.connect(changed)
This button inherits QPushButton but makes a few changes. We've defined a changed signal to track when the value of the button changes and added a keyword option so that this signal can be connected ...
Read now
Unlock full access