After importing PySide then you can see all PySide python submodule:
Also this can help you to see all about Qt components and versions using by PySide:
>>> 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']
Let's how can do it:
Something about PySide submodules:
# 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)
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:
You need sys python module also the application can have this option : sys.argv .
>>> import sys ... >>> from PySide import QtGui ... >>> app = QtGui.QApplication(sys.argv)
You can searching and used all your widgets.
For example :
The title of your application will be python.
>>> import sys >>> import PySide >>> from PySide import * >>> myapp = QtGui.QApplication(sys.argv) >>> mywidgets = QtGui.QWidget() >>> mywidgets.show()
You can set this title bellow show method , with :
About my class Example from pyside-introduction-part-001 then will told how to make one simple class example.
mywidgets.setWindowTitle('my app title ')
First I used this class named Example with this methods:
Into __init___ I used super() method.
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) ...
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 :
and also put my widgets under this with this python code:
app = QtGui.QApplication(sys.argv)
About events I will make another tutorial ...
ex = Example()