1 August 2023
Ссылка
click to show
click to show
Also this one I made, https://github.com/SciQLop/SciQLopPlots/tree/main/.github%2Fworkflows
from PySide6 import QtCore, QtWidgets
from PySide6.QtUiTools import QUiLoader
from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
loader = QUiLoader()
class UserInterface(QtCore.QObject): # An object wrapping around our UI
def __int__(self, parent=None):
super().__init__(parent)
self.ui = loader.load("widget.ui", None)
self.ui.setWindowTitle("User Data")
self.ui.submit_button.clicked.connect(self.do_something)
QPyDesignerCustomWidgetCollection.registerCustomWidget(self.ui, module="user interface")
def show(self):
self.ui.show()
def do_something(self):
print(f"{self.ui.full_name_line_edit.text()} is a {self.ui.occupation_line_edit.text()}")
Running main.py shows the following errors
qt.pysideplugin: Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out.
qt.pysideplugin: No instance of QPyDesignerCustomWidgetCollection was found.
Traceback (most recent call last):
File "/path/qt-examples/pyside6_examples/17_qdesigner_quiloader_v2/main.py", line 10, in <module>
window.show()
File "/path/qt-examples/pyside6_examples/17_qdesigner_quiloader_v2/user_interface.py", line 18, in show
self.ui.show()
^^^^^^^
AttributeError: 'UserInterface' object has no attribute 'ui'