网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
07月28日漏签0天
qt吧 关注:49,772贴子:159,371
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 1回复贴,共1页
<<返回qt吧
>0< 加载中...

[Qt for Python] Pyside6报错,求助!

  • 只看楼主
  • 收藏

  • 回复
  • 02644437741zsq
  • 初级粉丝
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
qt.pysideplugin: No instance of QPyDesignerCustomWidgetCollection was found.
出现这个之后窗口就会闪退


  • 02644437741zsq
  • 初级粉丝
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
[补充]
错误代码:
import sysimport os
from PySide6.QtCore import QFile, Slot # Qt文件处理器
from PySide6.QtUiTools import QUiLoader # UI文件导入器
from PySide6.QtWidgets import * # 导入Qt组件
@Slot()
def clicked():
name = window.name.toPlainText()
window.close()
ui_file = QFile("name.ui") # 设置UI文件为QFile对象
ui_file.open(QFile.ReadWrite) # 读写模式打开UI文件
ui_file.close() # 关闭文件
loader = QUiLoader() # 生成UI加载器
window2 = loader.load(ui_file) # 加载UI文件
window2.Text.text = "你好," + name
ui_file.close() # 关闭文件 window2.show()
app = QApplication(sys.argv) # 主APP
ui_file = QFile("mainWindow.ui") # 设置UI文件为QFile对象
ui_file.open(QFile.ReadOnly) # 只读模式打开
UI文件ui_file.close() # 关闭文件loader = QUiLoader() # 生成UI加载器
window = loader.load(ui_file) # 加载UI文件window.confirm.clicked.connect(clicked)
ui_file.close() # 关闭文件window.show()
sys.exit(app.exec()) # 退出
mainWindow.ui:
<?xml version="1.0" encoding="UTF-8"?><ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>557</width> <height>364</height> </rect> </property> <property name="windowTitle"> <string>测试</string> </property> <widget class="QWidget" name="centralwidget"> <widget class="QLabel" name="label"> <property name="geometry"> <rect> <x>80</x> <y>20</y> <width>201</width> <height>51</height> </rect> </property> <property name="text"> <string>&lt;font size = 30&gt;&lt;b&gt;请输入你的姓名&lt;/b&gt;&lt;/font&gt;</string> </property> </widget> <widget class="QCommandLinkButton" name="confirm"> <property name="geometry"> <rect> <x>20</x> <y>180</y> <width>511</width> <height>61</height> </rect> </property> <property name="text"> <string>确定</string> </property> <property name="checkable"> <bool>false</bool> </property> <property name="description"> <string>下一步</string> </property> </widget> <widget class="QCommandLinkButton" name="unusable"> <property name="enabled"> <bool>false</bool> </property> <property name="geometry"> <rect> <x>20</x> <y>250</y> <width>511</width> <height>61</height> </rect> </property> <property name="text"> <string>退出</string> </property> <property name="checkable"> <bool>false</bool> </property> <property name="description"> <string>取消并退出</string> </property> </widget> <widget class="QTextEdit" name="name"> <property name="geometry"> <rect> <x>50</x> <y>90</y> <width>451</width> <height>71</height> </rect> </property> <property name="placeholderText"> <string>在此处输入您的姓名...</string> </property> </widget> </widget> <widget class="QMenuBar" name="menubar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>557</width> <height>22</height> </rect> </property> </widget> <widget class="QStatusBar" name="statusbar"/> </widget> <resources/> <connections/></ui>
name.ui:
<?xml version="1.0" encoding="UTF-8"?><ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>348</width> <height>126</height> </rect> </property> <property name="windowTitle"> <string>MainWindow</string> </property> <widget class="QWidget" name="centralwidget"> <widget class="QLabel" name="Text"> <property name="geometry"> <rect> <x>20</x> <y>20</y> <width>321</width> <height>71</height> </rect> </property> <property name="text"> <string>&lt;font face = '经典行书简' color = 'red' size = 40&gt;&lt;b&gt;你好,&lt;/b&gt;&lt;/font&gt;</string> </property> <property name="textFormat"> <enum>Qt::AutoText</enum> </property> </widget> </widget> <widget class="QMenuBar" name="menubar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>348</width> <height>22</height> </rect> </property> </widget> <widget class="QStatusBar" name="statusbar"/> </widget> <resources/> <connections/></ui>


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 1回复贴,共1页
<<返回qt吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示