0% found this document useful (0 votes)
138 views

PySide Introduction

PySide is a Python binding for the Qt toolkit that allows developers to write GUI applications in Python. It provides full access to Qt classes and allows Python types to be used as parameters. PySide was created as an alternative to PyQt that is licensed under the more permissive LGPL instead of GPL. The document outlines Qt and PySide features, the differences between PyQt and PySide, and provides an example of using PySide to create a GUI application.

Uploaded by

austin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
138 views

PySide Introduction

PySide is a Python binding for the Qt toolkit that allows developers to write GUI applications in Python. It provides full access to Qt classes and allows Python types to be used as parameters. PySide was created as an alternative to PyQt that is licensed under the more permissive LGPL instead of GPL. The document outlines Qt and PySide features, the differences between PyQt and PySide, and provides an example of using PySide to create a GUI application.

Uploaded by

austin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

PySide

overview
Marc Poinot
(ONERA/DSNA)
Outline

Quite short but practical overview

▶Qt
■ Toolkit overview
■ Model/View

▶PySide
■ pyQt4 vs PySide
■ Designer & Cython

■ Widget bindings

■ Class reuse

PySide - Introduction
ONERA/PySide-2/8
[email protected]
Qt - Facts

▶Qt is cute
■ Cross platform application framework for GUI
X Window System, Windows...
■ C++ kernel + many bindings
Including Python
■ Release v5.3 05/2014
■ License GPL+LGPL+Commercial

Contact your own lawyer...

▶Components
■ Core: QtCore, QtGui...
■ Specialized: QtWebKit, QtSVG, QtSQL...

■ Tools : Creator, Designer...

PySide - Introduction
ONERA/PySide-3/8
[email protected]
Qt - Example

PySide - Introduction
ONERA/PySide-4/8
[email protected]
Python bindings

▶pyQt
■ The first to come
Some services have hard coded import PyQt4
■ GPL - Use only in free software

▶PySide
■ Some syntactic & behavior differences
■ LGPL - Use allowed in proprietary software

PySide overview hereafter mixes Qt/PySide features

PySide - Introduction
ONERA/PySide-5/8
[email protected]
PySide - Facts

▶Full Python binding


■ Qt classes as Python classes
■ Python types as parameter types

▶Release 1.2.2 04/2014


▶Reference documentation

http://pyside.github.io/docs/pyside/

▶Production process
■ Uses many steps
■ Better with setup & source management

PySide - Introduction
ONERA/PySide-6/8
[email protected]
PySide - Production process

W class Ui_W class WB(QWidget,Ui_W)


A.ui uic ui_A.pyx

Designer B.py

cython A.c A.so

A.rc rcc Res_rc.py

PySide - Introduction
ONERA/PySide-7/8
[email protected]
PySide - Example
from PySide.QtCore import *
from PySide.QtGui  import *
from Gview import gui

import numpy as NPY
import vtk
from os.path import splitext

class GMain(QWidget,gui.Ui_controlWindow):
  # ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  def __init__(self):
     QWidget.__init__(self,None)
     self.setupUi(self)
     self.b_load.clicked.connect(self.b_loadOneFile)
     self.b_X.clicked.connect(self.b_xaxis)
  # ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  def b_xaxis(self,pos=None):
     if (self.c_mirror.isChecked()): self.setAxis(pos,­1)
     else: self.setAxis(pos,1)
  # ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  def closeEvent(self, event):
     print '*** Gview: close'
     event.accept()
PySide - Introduction
ONERA/PySide-8/8
[email protected]
PySide
overview
Marc Poinot
(ONERA/DSNA)
Outline

Quite short but practical overview

▶Qt
■ Toolkit overview
■ Model/View

▶PySide
■ pyQt4 vs PySide
■ Designer & Cython
■ Widget bindings

■ Class reuse

PySide - Introduction
ONERA/PySide-2/8
[email protected]
Qt - Facts

▶Qt is cute
■ Cross platform application framework for GUI
X Window System, Windows...
■ C++ kernel + many bindings
Including Python
■ Release v5.3 05/2014
■ License GPL+LGPL+Commercial

Contact your own lawyer...

▶Components
■ Core: QtCore, QtGui...
■ Specialized: QtWebKit, QtSVG, QtSQL...
■ Tools : Creator, Designer...

PySide - Introduction
ONERA/PySide-3/8
[email protected]
Qt - Example

PySide - Introduction
ONERA/PySide-4/8
[email protected]
Python bindings

▶pyQt
■ The first to come
Some services have hard coded import PyQt4
■ GPL - Use only in free software

▶PySide
■ Some syntactic & behavior differences
■ LGPL - Use allowed in proprietary software

PySide overview hereafter mixes Qt/PySide features

PySide - Introduction
ONERA/PySide-5/8
[email protected]
PySide - Facts

▶Full Python binding


■ Qt classes as Python classes
■ Python types as parameter types

▶Release 1.2.2 04/2014


▶Reference documentation

http://pyside.github.io/docs/pyside/

▶Production process
■ Uses many steps
■ Better with setup & source management

PySide - Introduction
ONERA/PySide-6/8
[email protected]
PySide - Production process

W class Ui_W class WB(QWidget,Ui_W)


A.ui uic ui_A.pyx

Designer B.py

cython A.c A.so

A.rc rcc Res_rc.py

PySide - Introduction
ONERA/PySide-7/8
[email protected]
PySide - Example
from PySide.QtCore import *
from PySide.QtGui  import *
from Gview import gui

import numpy as NPY
import vtk
from os.path import splitext

class GMain(QWidget,gui.Ui_controlWindow):
  # ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  def __init__(self):
     QWidget.__init__(self,None)
     self.setupUi(self)
     self.b_load.clicked.connect(self.b_loadOneFile)
     self.b_X.clicked.connect(self.b_xaxis)
  # ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  def b_xaxis(self,pos=None):
     if (self.c_mirror.isChecked()): self.setAxis(pos,­1)
     else: self.setAxis(pos,1)
  # ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  def closeEvent(self, event):
     print '*** Gview: close'
     event.accept()
PySide - Introduction
ONERA/PySide-8/8
[email protected]

You might also like