如何在 Windows 中将 .ui 转换为 py? [英] How to convert .ui to py in windows ?

查看:49
本文介绍了如何在 Windows 中将 .ui 转换为 py?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我关注了这个link 在 Windows 中使用 python 将 .ui 转换为 .py 但它不起作用.我尝试安装 pyuic4 但它不起作用.python中是否有任何工具或库可以做到这一点?请提出建议.

I followed this link to convert .ui to .py using python in windows but its not working.I tried installing pyuic4 but its not working. Is there any tools or libraries in python for doing it? Please suggest .

推荐答案

为什么不直接导入?

why not just import it?

import sys
from PyQt4 import QtGui, uic
app = QtGui.QApplication(sys.argv)
widget = uic.loadUi('demo.ui')
widget.show()
sys.exit(app.exec_())

ps:抱歉我不能在评论区回答.我的名气太低了

ps: sorry i cant answer in comment section. my reputation too low

这篇关于如何在 Windows 中将 .ui 转换为 py?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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