<div dir="ltr">Thank-you very much for your insight. I must say, coming from the Qt C++ world, dynamically loading the ui at run-time seems unusual to me. Is there a performance hit? Why not use pyqt4uic to compile in the code into Python? What is the issue with that?</div><br><div class="gmail_quote"><div dir="ltr">On Wed, 1 Aug 2018 at 17:24, Kyle Altendorf <<a href="mailto:sda@fstab.net">sda@fstab.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On August 1, 2018 5:08:48 PM EDT, Christopher Probst <<a href="mailto:christop.probst@gmail.com" target="_blank">christop.probst@gmail.com</a>> wrote:<br>
>Helllo everybody,<br>
><br>
>Is there any best practice suggestion as to how to interact with the Qt<br>
>ui<br>
>files? Is it better to load them dynamically using the uic module with<br>
>the<br>
>load uic.loadUi method?<br>
><br>
>Or is it recommended to compile the ui files into python code using<br>
>pyuic4?<br>
<br>
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.<br>
<br>
<a href="https://github.com/altendky/basicpyqt5example/blob/e08e75d16819fddc0514c513f43fa5148e59722c/src/basicpyqt5example/mainwindow.py#L37" rel="noreferrer" target="_blank">https://github.com/altendky/basicpyqt5example/blob/e08e75d16819fddc0514c513f43fa5148e59722c/src/basicpyqt5example/mainwindow.py#L37</a><br>
<br>
Ui, UiBase = PyQt5.uic.loadUiType(<br>
    pathlib.Path(__file__).parents[0] / 'mainwindow.ui',<br>
)<br>
<br>
class MainWindow(UiBase):<br>
    def __init__(self, parent=None):<br>
        super().__init__(parent) self.ui = Ui()<br>
        self.ui.setupUi(self)<br>
<br>
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.<br>
<br>
Cheers,<br>
-kyle<br>
</blockquote></div>