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:
>>> 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:
# 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 see 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:
>>> 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 :
>>> 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 :
mywidgets.setWindowTitle('my app title ')
About my class Example from
pyside-introduction-part-001 then I will tell you how to make one simple class example.
First I used this class named Example with this methods:
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 :
-super() method lets you avoid referring to the base class explicitly and let you to use multiple inheritance.
The main function come with some source code:
Make the application :
app = QtGui.QApplication(sys.argv)
and also put my widgets under this with this python code:
ex = Example()
About events I will make another tutorial ...