Python的GUI框架PySide的安装配置教程

1031次阅读  |  发布于5年以前

(一)说在前面

Python自带了GUI模块Tkinter,只是界面风格有些老旧。另外就是各种GUI框架了。

之前安装过WxPython,并做了简单的界面。遂最近又重新搜索了一下网上关于Python GUI框架的问题,发现还是Qt呀。

Python的Qt有PyQt和PySide吧。PyQt 是商业及 GPL 的版权, 而 PySide 是 LGPL。大意也就是PyQt开发商业软件是要购买授权的,而PySide则不需要。二者代码基本一致,修改下import 基本剩余的代码皆可通用。所以毫不犹豫的选择了PySide。

(二)PySide的安装

(1)比较快捷省事的安装


    dizzy@dizzy-pc:~$ sudo add-apt-repository ppa:pyside

    You are about to add the following PPA to your system:
     Official Ubuntu packages for PySide Qt Bindings.

    dizzy@dizzy-pc:~$ sudo apt-get update

    # ... ... 

    dizzy@dizzy-pc:~$ sudo apt-get install python-pyside
    Reading package lists... Done
    Building dependency tree    
    Reading state information... Done
    The following extra packages will be installed:
     libphonon4 libpyside1.1 libqt4-help libqt4-scripttools libqt4-test
     libqtwebkit4 libshiboken1.1 phonon phonon-backend-gstreamer
     python-pyside.phonon python-pyside.qtcore python-pyside.qtdeclarative
     python-pyside.qtgui python-pyside.qthelp python-pyside.qtnetwork
     python-pyside.qtopengl python-pyside.qtscript python-pyside.qtsql
     python-pyside.qtsvg python-pyside.qttest python-pyside.qtuitools
     python-pyside.qtwebkit python-pyside.qtxml

(2)测试是否安装成功


    dizzy@dizzy-pc:~$ python

    Python 2.7.3 (default, Feb 27 2014, 20:00:17) 
    [GCC 4.6.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.

    >>> import PySide
    >>> dir(PySide)

复制代码 代码如下:

['all', 'builtins', 'doc', 'file', 'name', 'package', 'path', 'version', '__version_info__']

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8