开发者

Problems using PyQt's Resource System

开发者 https://www.devze.com 2022-12-09 14:57 出处:网络
I am trying to use PyQt\'s Resource System but it appears I have no clue what I am doing! I already have to application created, along with its GUI I am just trying to import some images to use with t

I am trying to use PyQt's Resource System but it appears I have no clue what I am doing! I already have to application created, along with its GUI I am just trying to import some images to use with the program.

I used the QtDesigner to create the resource file and I compiled it using pyrcc4.exe. But when I attempt to import the resource file I get this error:

Traceback (most recent call last):
  File "C:\Projects\main.py", line 14, in <module>
    import main_rc
  File "C:\Projec开发者_如何转开发ts\main_rc.py", line 482, in <module>
    qInitResources()
  File "C:\Projects\main_rc.py", line 477, in qInitResources
    QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
      TypeError: argument 2 of qRegisterResourceData() has an invalid type

What am I doing wrong?


pyrcc generates Python 2.x code by default.

Try regenerating your resource files using pyrcc with flag '-py3'

0

精彩评论

暂无评论...
验证码 换一张
取 消