When I was looking into adding some new features to an existing Anki add-on, I had to make sense of some files with the .ui
extension that had some Qt XML. The conclusion I got to is these are edited using Qt Creator (I installed Qt Creator 12.0.2 Community) and compiled into Python code using a User Interface Compiler. From reading the add-on source and Qt docs, I noticed an idiom for using the compiled Python.
If you have one of these files and want to make changes, install Qt Creator and open the file. From there you can design the UI:
On the left are all different types of Qt Widgets (and other types like layouts) that you can drag and drop onto the UI. On the right, you can see the object tree and edit attributes like objectName
and stuff.
I was just editing a small .ui
file that I made the other day to figure this out the first time:
XML code in the saved .ui
file:
Use pyuic6 to compile the .ui
file into Python:
pyuic6 -o lapse_review_ratio_form.py lapse_review_ratio_form.ui
That gives us the Python code:
The idiom for using this (some kind of import Ui_LapseReviewRatioWidget
is also necessary):
Also see Using a Designer UI File in Your Qt for Python Application