python界面设计模块_python之PySide界面编程及打包示例

摘要

:本文主要演示python中的界面编程,先PySide生成万年历界面,再从数据库提取对应的干支历,使用pyinstaller打包,文末附打包模块对比图。

53e700007fb36ed82975

一、PySide下载安装。

推荐,此网址python模块的安装文件很齐全。

53e600021d6b436093aa

个人是python3.5+64位系统,因此选择图示的版本。下载之后使用pip install即可。

50ae00046c897d82c11d

二、界面设计

进入模块安装目录"Lib/site-packages/PySide",运行designer.exe。

新建->选中Main Window->create新建窗口。

53e50003ac530a4e723c

把控件拖到新窗口上调整即可得到下图。

53e30003b2e5d42a6239

保存为calender.ui,打开看看其源码如下图。

50ac000424bb4eaeb8c6

上图红框的内容是修改后属性值。

三、转为python文件

打开cmd,进入calender.ui目录,输入命令。

53e60001e78178542199

打开新生成的python文件。

50ae00043a1ba344733f

四、数据库连接

新建UI_pySide.py文件,根据当前日期到数据库获取对应农历及干支历,并在textEdit显示。

53e60001fae0c3c4f64a

五、打包文件

先pip install pyinstaller安装打包模块,然后命令行进入相应目录。

50ae0004546a653e1870

-w是去除命令窗口,-i是添加程序图标,-F是创建可执行文件。

稍等片刻,即可在dist目录下找到exe文件。

53e6000203e5c2c3a579

六、小结

PySide跨平台支持Android、iOS、Linux。

python中界面编程除了PySide,还有Tkinter、wxPython、PyQt5等。

打包模块对比图 :

53e600020c4a1375914e

如果对您有帮助,请点赞支持!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Editorial Reviews Develop more dynamic and robust GUI applications using an open source cross-platform UI framework Overview Designed for beginners to help them get started with GUI application development Develop your own applications by creating customized widgets and dialogs Written in a simple and elegant structure to help you easily understand how to program various GUI components In Detail Elegantly built GUI applications are always a massive hit among users. PySide is an open source software project that provides Python bindings for the Qt cross-platform UI framework. Combining the power of Qt and Python, PySide provides easy access to the Qt framework for Python developers and also acts as an excellent rapid application development platform available on all major operating systems. This book aims to help you develop GUI applications easily using PySide. Python is easy to learn and use and its programs are relatively shorter than those written in other programming languages like C++ or Java. This book will introduce you to user interface programming in Python, allowing you to develop real-time applications in a shorter amount of time. This book will take you through everything you need to know to develop UI applications. You will learn about installing/building PySide in various major operating systems as well as the basics of GUI programming. The book will then move on to discuss event management, signals and slots, and the widgets and dialogs available with PySide. Database interaction and manipulation is also covered. In a nutshell, this book is great for learning how to program applications with GUI and for mastering how to develop your own applications and how to run them across platforms. What you will learn from this book Download and install/build PySide, a cross-platform GUI development toolkit for Python Program GUI applications in an easy and efficient way Create and work with windowed applications Create menus, toolbars, status bars, and child windows Connect your GUI to a database and manage it Approach An accessible and practical guide to developing GUI’s for Python applications. Who this book is written for This book is written for Python programmers who want to learn about GUI programming. It is also suitable for those who are new to Python but are familiar with object-oriented programming. Table of Contents Chapter 1: Getting Started with PySide Chapter 2: Entering through Windows Chapter 3: Main Windows and Layout Management Chapter 4: Events and Signals Chapter 5: Dialogs and Widgets Chapter 6: Handling Databases Book Details Title: PySide GUI Application Development Author: Venkateshwaran Loganathan Length: 140 pages Edition: 1 Language: English Publisher: Packt Publishing Publication Date: 2013-10-15 ISBN-10: 1849699593 ISBN-13: 9781849699594

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值