Issue
We can use qt designer to create pyqt or pyside UI.
Ex) exUI.py
MainWindow.setObjectName("MainWindow")
MainWindow.resize(484, 371)
self.centralWidget = QtWidgets.QWidget(MainWindow)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
Ex) exUI.ui(or XML)
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>484</width>
<height>371</height>
</rect>
</property>
<property name="windowTitle">
When creating a ui using qt designer, a ui file is created as an output.
There are also functions that change the ui to a python file. But I'm curious why you change it to a python file.
A ui file can easily write ui, so why change it back to a python file and make it inconvenient?
Not everyone uses this method, but some do. I wonder if there is a difference in using different file extensions.
Assuming that ui behaves differently when it is a ui file and a python file, I would like to know if PySide and PyQt are both that different.
Solution
TL; DR; Both are generally equivalent forms.
The .ui is just an XML that has the settings (type of widgets, geometry, etc.) to create a widget, that is, Qt developed that format so that the user can design the GUI using the QtDesigner tool quickly and easily.
That .ui is parsed by other methods to create the code that creates the GUI. This parsing can be static (using uic or pyuic) or dynamic (using loadUi, loadUiType, QUiLoader, etc).
The use of one or the other method depends on the developer, and for example if the .ui is used through dynamic methods then the IDEs will hardly help in the autocompletion.
In conclusion, there is no difference since in the end the .ui is converted to code. But there may be a difference in how PyQt and PySide are converted to code since each company can take certain default settings.
One drawback with using .ui is that it obviously takes some time to parse and create dynamic objects, plus you won't benefit from pre-compiling the .py code in most modern versions of python, but in In general, that time cost is minimal.
Answered By - eyllanesc
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.