[PyQt] pyuic4 vs uic Module
sda at fstab.net
Wed Aug 1 22:24:23 BST 2018
On August 1, 2018 5:08:48 PM EDT, Christopher Probst <christop.probst at gmail.com> wrote:
>Is there any best practice suggestion as to how to interact with the Qt
>files? Is it better to load them dynamically using the uic module with
>load uic.loadUi method?
>Or is it recommended to compile the ui files into python code using
I'm not sure any caveats between 4 vs 5 but I much prefer loading at run time. Here's what I'm tending towards now.
Ui, UiBase = PyQt5.uic.loadUiType(
pathlib.Path(__file__).parents / 'mainwindow.ui',
def __init__(self, parent=None):
super().__init__(parent) self.ui = Ui()
The one caveat that I'm aware of is the lack of a .py file for an IDE to parse for help completing names. I'll note that there is a call in uic for compiling without having to run pyuic from the command line so some hybrid might make sense.
More information about the PyQt