运行脚本时不会显示Qt按钮

运行脚本时不会显示Qt按钮,qt,Qt,界面完全显示在Qt中,但在运行python脚本时,没有显示所有按钮 在Qt中: 手稿: 在线搜索,未发现类似问题。 如果有人能在这方面帮助我,请提前感谢 其他信息 python脚本: class Main(QMainWindow): def __init__(self, parent=None): QWidget.__init__(self, parent) uic.loadUi("edytor.ui", self) self

界面完全显示在Qt中,但在运行python脚本时,没有显示所有按钮

在Qt中:

手稿:

在线搜索,未发现类似问题。 如果有人能在这方面帮助我,请提前感谢

其他信息

python脚本:

    class Main(QMainWindow):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        uic.loadUi("edytor.ui", self)

        self.layout = []
        self.rgb_layout = []

    self.loadlayout.clicked.connect(self.getfile)

if __name__ == "__main__":
    def run_app():
        app = QApplication(sys.argv)
        mapp = Main()

        mapp.show()
        sys.exit(app.exec_())

    run_app()
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>notepad</class>
 <widget class="QWidget" name="notepad">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>659</width>
    <height>191</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Scan</string>
  </property>
  <widget class="QPushButton" name="loadlayout">
   <property name="geometry">
    <rect>
     <x>50</x>
     <y>90</y>
     <width>141</width>
     <height>31</height>
    </rect>
   </property>
   <property name="font">
    <font>
     <pointsize>-1</pointsize>
     <weight>50</weight>
     <italic>false</italic>
     <bold>false</bold>
    </font>
   </property>
   <property name="styleSheet">
    <string notr="true">background: white;
border-style: outset;
border-width: 0.5px;
border-radius: 5px;
border-color: gray;
font: 14px;</string>
   </property>
   <property name="text">
    <string>Load Layout Image</string>
   </property>
   <property name="checkable">
    <bool>true</bool>
   </property>
   <property name="autoDefault">
    <bool>false</bool>
   </property>
   <property name="default">
    <bool>true</bool>
   </property>
   <property name="flat">
    <bool>false</bool>
   </property>
  </widget> 
 </widget>
 <resources/>
 <connections/>
</ui>
用于“edytor.ui”的脚本:

    class Main(QMainWindow):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        uic.loadUi("edytor.ui", self)

        self.layout = []
        self.rgb_layout = []

    self.loadlayout.clicked.connect(self.getfile)

if __name__ == "__main__":
    def run_app():
        app = QApplication(sys.argv)
        mapp = Main()

        mapp.show()
        sys.exit(app.exec_())

    run_app()
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>notepad</class>
 <widget class="QWidget" name="notepad">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>659</width>
    <height>191</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Scan</string>
  </property>
  <widget class="QPushButton" name="loadlayout">
   <property name="geometry">
    <rect>
     <x>50</x>
     <y>90</y>
     <width>141</width>
     <height>31</height>
    </rect>
   </property>
   <property name="font">
    <font>
     <pointsize>-1</pointsize>
     <weight>50</weight>
     <italic>false</italic>
     <bold>false</bold>
    </font>
   </property>
   <property name="styleSheet">
    <string notr="true">background: white;
border-style: outset;
border-width: 0.5px;
border-radius: 5px;
border-color: gray;
font: 14px;</string>
   </property>
   <property name="text">
    <string>Load Layout Image</string>
   </property>
   <property name="checkable">
    <bool>true</bool>
   </property>
   <property name="autoDefault">
    <bool>false</bool>
   </property>
   <property name="default">
    <bool>true</bool>
   </property>
   <property name="flat">
    <bool>false</bool>
   </property>
  </widget> 
 </widget>
 <resources/>
 <connections/>
</ui>

便条簿
0
0
659
191
扫描
50
90
141
31
-1
50
假的
假的
背景:白色;
边界样式:开始;
边框宽度:0.5px;
边界半径:5px;
边框颜色:灰色;
字体:14px;
加载布局图像
真的
假的
真的
假的

< Python代码没有显示错误。

我只知道C++ Qt。您使用的是.ui文件还是qml?打印错误了吗?可能找不到ui/qml文件?例如,在qml的情况下,会打印“组件未准备就绪”。这些图像说明不了什么。您不能发布任何代码吗?请确保将按钮添加到布局中。@Frankosterfield这是什么意思?我在布局中添加了按钮。问题是这个脚本以前运行得很好,但最近不起作用。