May 2019
Intermediate to advanced
542 pages
13h 37m
English
If you were to open your calendar_form.ui file in a text editor, you'd see that it is neither Python nor C++, but rather an XML representation of the GUI you've designed. PyQt offers us a few choices for how to use the .ui file in a Python application.
The first approach is to convert the XML into Python using the pyuic5 tool included with PyQt. Open a command-line window in the directory where your .ui files are and run the following command:
$ pyuic5 calendar_form.ui
This will generate a file called calendar_form.py. If you open this file in your code editor, you'll see that it contains a single class definition for a Ui_MainWindow class, as follows:
class Ui_MainWindow(object): def setupUi(self, MainWindow): ...
Read now
Unlock full access