主题描述了如何为常规 Python App 添加 Qtitan 组件。本主题中描述的步骤与任何 Qtitan 组件相关 – QtitanRibbon、QtitanChart、QtitanNavigation、QtitanDocking、QtitanDataGrid。
主题描述了如何为常规 Python App 添加 Qtitan 组件。本主题中描述的步骤与任何 Qtitan 组件相关 – QtitanRibbon、QtitanChart、QtitanNavigation、QtitanDocking、QtitanDataGrid。
先决条件
要使用 Qtitan Component for Python,您需要:
- 从这里安装 Python3.6 或更高版本https://www.python.org
- MS Visual Studio 或 Qt-Creator
- 需要按照此处的说明安装 PySide2 和 shiboken2 https://wiki.qt.io/Qt_for_Python/GettingStarted
- 如果您需要为 Qtitan 组件重建 Python bingings,您必须安装 shiboken2-generator 包。您可以通过此链接找到 shiboken2-generator 的轮子:https : //download.qt.io/official_releases/QtForPython/shiboken2-generator/
第 1 步:为 Python 安装 Qtitan 组件
- 转到页面https://www.evget.com/productlistw=Qtitan
- 下载您使用的平台的安装程序。Python 所需的组件在安装程序名称中带有后缀 PySide2。
- 按照安装程序向导的建议安装它。
- 安装过程后,您将在 <QTITAN_INSTALL_PATH>site-packages/DevMachines 文件夹中拥有 python 绑定。
Additionally the bindings will be installed to the your Python third-party libraries folder where the PySide2 was installed.For instance:c:PythonPython37-32Libsite-packagesPySide2c:PythonPython37-32Libsite-packagesshiboken2c:PythonPython37-32Libsite-packagesDevMachines
要为您的环境获取 Python 站点包目录,请在 shell 中执行以下命令行:
python -c "import site; print(site.getsitepackages())"
第 2 步:将组件添加到您的 Python 文件 (*.py)
将 Qtitan 组件添加到 Python 文件中。DevMachines 命名空间中的所有组件。
from DevMachines.QtitanBase import WindowTitleBarfrom DevMachines.QtitanRibbon import AdobePhotoshopStyle, Office2016Style类比其他 Qtitan 组件:
from DevMachines.QtitanGrid import Gridfrom DevMachines.QtitanNavigationDesignUI import NavigationView第 3 步:运行您的 Python 应用程序
运行您的 Python 应用程序并确保没有任何错误和警告。
从源代码构建 Qtitan For Python 组件绑定
主题描述了如何从源代码构建Qtitan For Python 组件绑定。
视窗视觉工作室
对于 Visual Studio,您必须使用 Visual Studio Toolkit 2015 来构建绑定。如果您将使用 2017 Toolkit,您将收到来自 shiboken2-generator 的错误。
Open the bat shell. "Windows logo key" + R, cmd.exeSet current directory to the <QTITAN_INSTALL_PATH>. C:/>dir <QTITAN_INSTALL_PATH>vcvars32_2015.batqmake.exe -r CONFIG+=python -platform win32-msvcnmake release在构建过程之后,您将在 <QTITAN_INSTALL_PATH>site-packages/DevMachines 文件夹中拥有一个新的绑定库。
Qt组件推荐:
- QtitanRibbon |下载试用:遵循Microsoft Ribbon UI Paradigm for Qt技术的Ribbon UI组件,研究为Windows、Linux和Mac OS X提供功能完整的Ribbon组件。
- QtitanChart |下载试用:是一个C++库,代表一组,这些控件使您可以快速地为应用程序提供漂亮而丰富的图形。并且支持所有主要的桌面
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!