无法启动 Qt uic [英] Unable to Launch Qt uic

查看:95
本文介绍了无法启动 Qt uic的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 Qt 设计器 4.8.2、Pyside 和 Python 3.3.当我使用 Qt 设计器创建表单时,单击查看代码时看不到代码.错误信息是:无法启动 C:\Qt\4.8.2\bin\uic".我在 C:\Python33\Lib\site-packages\PyQt4\uic 下有 pyuic.请帮忙.

I have installed Qt designer 4.8.2, Pyside, and Python 3.3. When I create a form with Qt designer I am not able to see the code when clicking on view code. The error message is:"Unable to launch C:\Qt\4.8.2\bin\uic". I have the pyuic under C:\Python33\Lib\site-packages\PyQt4\uic. Please help.

推荐答案

虽然您当然可以使用 Qt Designer 为 PySide/PyQt 创建 UI,但您应该意识到它主要是一个 C++ 工具 - 它没有任何内置对 Python 的支持.因此,您引用的查看代码..."命令仅生成 C++ 代码 - 如果您打算使用 PySide 或 PyQt,这可能对您没有多大用处.

Although you can certainly use Qt Designer for creating UIs for PySide/PyQt, you should be aware that it is primarily a C++ tool - it doesn't have any built in support for Python. So the "View Code..." command you refer to only produces C++ code - which is probably not much use to you if you intend using PySide or PyQt.

Qt Designer UI 文件采用 XML 格式(它们通常具有 .ui 扩展名).

Qt Designer UI files are in an XML format (they usually have a .ui extension).

要在 Python 中使用它们,基本上有两种选择:

To use them with Python, there are basically two options:

  1. 将 .ui 文件直接加载到您的应用程序中.
  2. 使用外部工具将 .ui 文件转换为 Python 模块.

PySide 和 PyQt 在这两个选项的实现方式上存在一些差异.

There are several differences between PySide and PyQt in how these two options are implemented.

对于 PyQt,可以在这里找到两个选项的完整文档.

For PyQt, the full documention for both options can be found here.

对于 PySide,可以找到选项 1 的文档here - 但似乎没有选项 2 的任何文档.但是,PySide 的外部工具(称为 pyside-uic)的工作方式与 forPyQt(称为pyuic4).

For PySide, the documentation for option 1 can be found here - but it does not look like there is any documentation for option 2. However, the external tool for PySide (which is called pyside-uic) works very similarly to the one for PyQt (which is called called pyuic4).

如果您需要有关如何开始使用 Qt 和 Python 的更多一般信息,请尝试PySide WikiPyQt Wiki.

If you need more general information about how to get started using Qt with Python, try the PySide Wiki or the PyQt Wiki.

这篇关于无法启动 Qt uic的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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