First, PySide itself is licensed under LGPLv2.1, most of the examples are licensed under GPLv2.
After importing PySide then you can see all PySide python submodule:
1 2 3 4 5 6 7 | >>> import PySide >>> from PySide import * >>> dir(PySide) ['QtCore', 'QtGui', 'QtNetwork', 'QtOpenGL', 'QtScript', 'QtSql', 'QtSvg', 'QtTe st', 'QtWebKit', '__all__', '__builtins__', '__doc__', '__file__', '__name__', ' __package__', '__path__', '__version__', '__version_info__', '_setupQtDirectorie s', '_utils'] |
Also this can help you to see all about Qt components and versions using by PySide:
Let’s how can do it:
1 2 3 4 5 6 7 8 9 10 11 12 | # prints PySide version >>> print PySide.__version__ 1.2.2 # gets a tuple with each version component >>> print PySide.__version_info__ (1, 2, 2, 'final', 0) # prints the Qt version used to compile PySide >>> print PySide.QtCore.__version__ 4.8.5 # gets a tuple with each version components of Qt used to compile PySide >>> print PySide.QtCore.__version_info__ (4, 8, 5) |
Something about PySide submodules:
QtCore – core non-GUI functionality;
QtGui – extends QtCore with GUI functionality;
QtNetwork – offers classes that allow you to write TCP/IP clients and servers;
QtOpenGL – offers classes that make it easy to use OpenGL in Qt applications;
QtScript – provides classes for making Qt applications scriptable;
QtSql – helps you provide seamless database integration to your Qt applications;
QtSvg – provides classes for displaying the contents of SVG files;
QtWebkit – provides a Web browser engine;
The QtTest submodule can be used to test your PySide script code.
The structure PySide application can be seen under my first tutorial.
About this PySide application, most of this can be created with classes
To make one GUI ( ) just import QtGUI with your class …
This source code can be used also you can get some errors:
1 2 3 4 5 | >>> import sys ... >>> from PySide import QtGui ... >>> app = QtGui.QApplication(sys.argv) |
You need sys python module also the application can have this option: sys.argv .
You can searching and used all your widgets.
For example :
1 2 3 4 5 6 | >>> import sys >>> import PySide >>> from PySide import * >>> myapp = QtGui.QApplication(sys.argv) >>> mywidgets = QtGui.QWidget() >>> mywidgets.show() |
The title of your application will be python.
You can set this title bellow show method, with :
1 | mywidgets.setWindowTitle('my app title ') |
Now, about my class Example from PySide-introduction-part-001 – I will tell you how to make one simple class example.
First I used this class named Example with these methods:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | class Example(QtGui.QWidget): ... #defaul init class method __init__(self) ... #make and show the window application initUI(self) ... #my method to put the window to the desktop screen center(self) ... #method to deal with events and also close the application closeEvent(self, event) ... |
Into __init___ I used super() method.
The main reason I used this it’s :
-the super() method lets you avoid referring to the base class explicitly and let you use multiple inheritances.
The main function comes with some source code:
Make the application :
1 | app = QtGui.QApplication(sys.argv) |
and also put my widgets under this with this python code:
1 | ex = Example() |
About events, I will make another tutorial …