"Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out."
"Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out."
我安装了开源qt creator(免费版)并创建了非常简单的桌面应用程序。我能够创建简单的 window 但是当我 运行 我收到以下错误:
我已尝试关注此页面,但无法解决此问题
https://www.qt.io/blog/qt-for-python-6.1
Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out.
No instance of QPyDesignerCustomWidgetCollection was found.
Python 文件
# This Python file uses the following encoding: utf-8
import os
from pathlib import Path
import sys
from PySide6.QtWidgets import QApplication, QMainWindow
from PySide6.QtCore import QFile
from PySide6.QtUiTools import QUiLoader
class test(QMainWindow):
def __init__(self):
super(test, self).__init__()
self.load_ui()
def load_ui(self):
loader = QUiLoader()
path = os.fspath(Path(__file__).resolve().parent / "form.ui")
ui_file = QFile(path)
ui_file.open(QFile.ReadOnly)
loader.load(ui_file, self)
ui_file.close()
if __name__ == "__main__":
app = QApplication([])
widget = test()
widget.show()
sys.exit(app.exec_())
添加xml
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>test3</class>
<widget class="QMainWindow" name="test3">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1332</width>
<height>702</height>
</rect>
</property>
<property name="windowTitle">
<string>test3</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QCheckBox" name="checkBox">
<property name="geometry">
<rect>
<x>300</x>
<y>240</y>
<width>70</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1332</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionOpen"/>
<addaction name="actionsave"/>
</widget>
<widget class="QMenu" name="menuEdit">
<property name="title">
<string>Edit</string>
</property>
</widget>
<widget class="QMenu" name="menuArchive_and_update_indicator">
<property name="title">
<string>Archive and update indicator</string>
</property>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
<addaction name="menuArchive_and_update_indicator"/>
</widget>
<action name="actionOpen">
<property name="text">
<string>Open</string>
</property>
</action>
<action name="actionsave">
<property name="text">
<string>Save</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>
您正在看到来自 PySide6 中一项名为“自定义小部件”的新实验性功能的信息性消息。要使消息静音,您可以将变量“PYSIDE_DESIGNER_PLUGINS”设置为“.”对于当前文件夹。
https://www.qt.io/blog/qt-for-python-6.1 状态:
A new experimental plugin for Linux and Windows is shipped that provides > support for writing custom widgets in Python, which can then be selected > from Qt Designer to be used in layouts. Some extra magic is required to > enable this on macOS. We hope to have it ready in 6.1.1!
可在此处找到有关此功能的更多信息:
我安装了开源qt creator(免费版)并创建了非常简单的桌面应用程序。我能够创建简单的 window 但是当我 运行 我收到以下错误:
我已尝试关注此页面,但无法解决此问题
https://www.qt.io/blog/qt-for-python-6.1
Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out.
No instance of QPyDesignerCustomWidgetCollection was found.
Python 文件
# This Python file uses the following encoding: utf-8
import os
from pathlib import Path
import sys
from PySide6.QtWidgets import QApplication, QMainWindow
from PySide6.QtCore import QFile
from PySide6.QtUiTools import QUiLoader
class test(QMainWindow):
def __init__(self):
super(test, self).__init__()
self.load_ui()
def load_ui(self):
loader = QUiLoader()
path = os.fspath(Path(__file__).resolve().parent / "form.ui")
ui_file = QFile(path)
ui_file.open(QFile.ReadOnly)
loader.load(ui_file, self)
ui_file.close()
if __name__ == "__main__":
app = QApplication([])
widget = test()
widget.show()
sys.exit(app.exec_())
添加xml
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>test3</class>
<widget class="QMainWindow" name="test3">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1332</width>
<height>702</height>
</rect>
</property>
<property name="windowTitle">
<string>test3</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QCheckBox" name="checkBox">
<property name="geometry">
<rect>
<x>300</x>
<y>240</y>
<width>70</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1332</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionOpen"/>
<addaction name="actionsave"/>
</widget>
<widget class="QMenu" name="menuEdit">
<property name="title">
<string>Edit</string>
</property>
</widget>
<widget class="QMenu" name="menuArchive_and_update_indicator">
<property name="title">
<string>Archive and update indicator</string>
</property>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
<addaction name="menuArchive_and_update_indicator"/>
</widget>
<action name="actionOpen">
<property name="text">
<string>Open</string>
</property>
</action>
<action name="actionsave">
<property name="text">
<string>Save</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>
您正在看到来自 PySide6 中一项名为“自定义小部件”的新实验性功能的信息性消息。要使消息静音,您可以将变量“PYSIDE_DESIGNER_PLUGINS”设置为“.”对于当前文件夹。
https://www.qt.io/blog/qt-for-python-6.1 状态:
A new experimental plugin for Linux and Windows is shipped that provides > support for writing custom widgets in Python, which can then be selected > from Qt Designer to be used in layouts. Some extra magic is required to > enable this on macOS. We hope to have it ready in 6.1.1!
可在此处找到有关此功能的更多信息: