在 PySide2.QtWidgets.QTabWidget(MyWindow) 中,带有形式转换的 window.ui 转换为 window.py 错误 [英] The window.ui with form conveted converted to window.py error in PySide2.QtWidgets.QTabWidget(MyWindow)

查看:41
本文介绍了在 PySide2.QtWidgets.QTabWidget(MyWindow) 中,带有形式转换的 window.ui 转换为 window.py 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个窗口

在我做的 Python 代码中:

def __init__(self):尝试:super(QDialog, self).__init__()super(MyWindow, self).__init__()self.ui = uic.loadUi('CreateUsers.ui', self)

你可以证明我使用了CreateUsers.ui"文件,但我使用了 pyside2-uic CreateUsers.ui > ui_create_user.py 并尝试以这种方式使用:

def __init__(self):尝试:super(QDialog, self).__init__()super(MyWindow, self).__init__()#self.ui = uic.loadUi('CreateUsers.ui', self)self.ui = Ui_Form()self.ui.setupUi(self)

我在使用 pyinstaller 的 EXE 中转换了这一切,但是当我尝试使用 PySide2 时出现错误并显示以下消息:

FIXME 下标泛型不能与类和实例检查一起使用错误:使用错误的参数类型调用了PySide2.QtWidgets.QTabWidget":PySide2.QtWidgets.QTabWidget(MyWindow)支持的签名:PySide2.QtWidgets.QTabWidget(typing.Union[PySide2.QtWidgets.QWidget, NoneType] = None)

窗口也显示为空

我用python创建的这个应用程序来管理SAP用户创建的.此应用程序加载所有 sap 用户,从 ProcessMaker 加载将要创建的用户列表,我们使用此工具 (AutoSAP) 一键检查是否正常,我们在 SAP 中创建用户.

请问,有人想我解决这个问题吗?

解决方案

CreateUsers.ui 在 pyinstaller 捆绑二进制文件中丢失.在 datas 参数中传递 CreateUsers.ui 或使用上述规范文件来提供缺少的 CreateUsers.ui

<块引用>

在再次尝试 pyinstaller 之前,您可以将 CreateUsers.ui 复制到pyinstaller 输出文件夹进行测试

block_cipher = 无a = Analysis(['minimal.py'],pathex=['/Developer/PItests/minimal'],二进制文件=无,数据=无,隐藏进口=[],钩子路径=无,runtime_hooks=无,排除=无,密码=block_cipher)pyz = PYZ(a.pure, a.zipped_data,密码=block_cipher)exe = EXE(pyz,...)科尔 = 收集(...)

<块引用>

datas:应用程序中包含的非二进制文件,包括由--add-data 选项.

pyinstaller 参考

I create a window

and in the Python code I did:

def __init__(self):
    try:
        super(QDialog, self).__init__()
        super(MyWindow, self).__init__()
        self.ui = uic.loadUi('CreateUsers.ui', self)

You can show that I used "CreateUsers.ui" file, but I used pyside2-uic CreateUsers.ui > ui_create_user.py and tried to use with this way:

def __init__(self):
    try:
        super(QDialog, self).__init__()
        super(MyWindow, self).__init__()
        #self.ui = uic.loadUi('CreateUsers.ui', self)
        self.ui = Ui_Form()
        self.ui.setupUi(self)

I converted this all in EXE used pyinstaller, but when I try to use appear a error in PySide2 with these messages:

FIXME Subscripted generics cannot be used with class and instance checks
Erro na tela inicial: 'PySide2.QtWidgets.QTabWidget' called with wrong argument types:
  PySide2.QtWidgets.QTabWidget(MyWindow)
Supported signatures:
  PySide2.QtWidgets.QTabWidget(typing.Union[PySide2.QtWidgets.QWidget, NoneType] = None)

The window appeared empty too

This application I created in python to manage SAP users create. This application load all sap users, load from ProcessMaker a list of users that will be create and we use this tool(AutoSAP) to with one button and others to check if ok, we create users in SAP.

Please, somebody has an idea with I solve this issue?

解决方案

CreateUsers.ui is missing on pyinstaller bundled binaries. pass CreateUsers.ui in datas argment or use a spec file as above to provide missing CreateUsers.ui

before trying the pyinstaller again you may copy CreateUsers.ui to pyinstaller output folder to test

block_cipher = None
a = Analysis(['minimal.py'],
     pathex=['/Developer/PItests/minimal'],
     binaries=None,
     datas=None,
     hiddenimports=[],
     hookspath=None,
     runtime_hooks=None,
     excludes=None,
     cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
     cipher=block_cipher)
exe = EXE(pyz,... )
coll = COLLECT(...)

datas: non-binary files included in the app, including names given by the --add-data option.

pyinstaller reference

这篇关于在 PySide2.QtWidgets.QTabWidget(MyWindow) 中,带有形式转换的 window.ui 转换为 window.py 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆