pyqt 使用 Qt Designer 设计的ui文件
来源:互联网 发布:win7公用网络是黑色的 编辑:程序博客网 时间:2024/05/29 08:49
qt的一个强大之后便是可以直观地使用 qt designer 设计界面,pyqt也可以使用这个ui文件,大大简化了ui的设计时间。
使用方法:
如果没有使用eric一类的IDE,那么可以使用命令行的方式将ui文件转化成.py文件,pyqt是自带pyuic.py这个工具的。
首先,必须在给python安装了pyqt,安装方法见http://blog.csdn.net/lainegates/article/details/8656102
然后,使用Qt Designer设计好ui文件,保存为form.ui,假设路径为D:/
最后,打开cmd,进入pyqt的uic目录,我的是C:\Python26\Lib\site-packages\PyQt4\uic,输入 "python pyuic.py -o D:/ui_form.py D:/form.ui",然后就会在form.ui所在目录生成它对应的.py文件了。
测试载入UI文件:
class UItest(QtGui.QMainWindow): def __init__(self,parent=None): QtGui.QWidget.__init__(self,parent) self.loginGui() def loginGui(self): self.ui = Ui_Dialog() self.ui.setupUi(self) self.show()app = QtGui.QApplication(sys.argv)myqq = UItest()sys.exit(app.exec_())
NAME
pyuic4 - compile Qt4 user interfaces to Python code
SYNOPSIS
pyuic4 [OPTION]... FILE
DESCRIPTION
pyuic4 takes a Qt4 user interface description file and compiles it to
Python code. It can also show a preview of the user interface.
OPTIONS
-h, --help
Show a summary of the options.
--version
Display the version number of pyuic4 of the version of Qt which
PyQt4 was generated for.
-p, --preview
Show a preview of the UI instead of generating Python code.
-o, --output=FILE
Write the generated Python code to FILE instead of stdout.
-d, --debug
Show detailed debugging information about the UI generation
process.
-x, --execute
Generate extra code to test and display the class when executed
as a script.
-i, --indent=NUM
Set the indentation width to NUM spaces. A TAB character will be
used if NUM is 0 (default: 4).
- pyqt 使用 Qt Designer 设计的ui文件
- PyQt 使用Qt Designer ui文件
- [PyQt]使用Qt Designer设计师完成PyQt界面图标设计
- qt designer设计的.ui文件转.py文件
- 如何利用qt designer设计的ui文件
- Qt Designer设计 UI 文件并调用
- Qt Designer设计 UI 文件并调用
- Qt Designer设计 UI 文件并调用
- 使用Qt designer设计UI界面入门
- 如何使用Qt Designer生成的ui文件
- 【PyQt】Qt designer中Stylesheet使用的注意事项
- Qt designer 打不开ui文件的解决方法
- pyqt开发之使用Qt-designer
- pyqt4使用qt designer设计的ui文件的方法(将ui文件转换为python源码和类的方法)
- 使用Qt Designer生成的ui文件的几种方式
- Qt开发环境突然坏了,无使用 designer打开UI的文件
- PyQt + QtDesigner的ui文件
- 3.Qt designer 的ui
- linux mysql出现1130 错误的解决办法!
- Android漂浮窗口
- poj 1584
- LaTex编译时出现的PNG图片转换成EPS格式
- C++基础
- pyqt 使用 Qt Designer 设计的ui文件
- hdu1279验证角谷猜想
- android适配
- poj2559 Largest Rectangle in a Histogram hdu1505 City Game
- Cocos2d配置环境
- [C++]常量定义
- int 和 String 互相转换的多种方法
- 大话存储系列6——RAID实现
- JFace Wizard 自定义 “Next” 按钮事件