In [1]:
    
#Global initialize
import sys
import os
#for Home: ipython notebook
os.chdir("/Users/chenchen/Documents/Git/ipynotebook/pyside/")
sys.version
#for office: ipython3-3.3 notebook
#os.chdir("/Users/chenchen/Documents/git/ipynotebook/pyside/")
#sys.version
    
    Out[1]:
In [2]:
    
%qtconsole
    
In [2]:
    
%qtconsole
    
In [3]:
    
import sys
import os
os.chdir("/Users/chenchen/Documents/Git/ipynotebook/pyside/")
    
In [4]:
    
from PySide import QtGui, QtCore
    
In [5]:
    
app = QtGui.QApplication(sys.argv)
    
In [6]:
    
label = QtGui.QLabel("<h1><font color=red>Hello, Qt</font></h1>")
    
In [7]:
    
label.show()
sys.exit(app.exec_())
    
    
    
In [79]:
    
%%writefile view.qml
import QtQuick 1.1
Rectangle {
    width: 200
    height: 200
    color: "red"
    
    Text {
        //id: test
        text: qsTr("Hello World")
        anchors.centerIn: parent
    }
}
    
    
In [8]:
    
%%writefile view.qml
import QtQuick 1.1
Rectangle {
    width: 200
    height: 62
    color: "white"
    Text {
        id: test
        text: "Hello World"
        color: "blue"
        anchors.centerIn: parent
    }
}
    
    
In [9]:
    
#the main.py
import sys
from PySide import QtCore, QtGui
from PySide.QtDeclarative import QDeclarativeView
    
In [4]:
    
#Creat app
app = QtGui.QApplication(sys.argv)
    
In [10]:
    
#view
view = QDeclarativeView()
    
In [11]:
    
#Creat an URL to the QML file
url = QtCore.QUrl("view.qml")
    
In [12]:
    
#set the QML file and show
view.setSource(url)
    
In [13]:
    
#show and quit
view.show()
sys.exit(app.exec_())
    
    
    
In [15]:
    
import PySide
    
In [16]:
    
PySide.__version__
    
    Out[16]:
In [17]:
    
import PySide.QtCore
    
In [18]:
    
PySide.QtCore.__version__
    
    Out[18]:
In [19]:
    
PySide.QtCore.qVersion()
    
    Out[19]:
In [20]:
    
import sys
    
In [21]:
    
import PySide
    
In [22]:
    
from PySide.QtGui import QApplication
from PySide.QtGui import QMessageBox
    
In [ ]:
    
#Create the application opject
app = QApplication(sys.argv)
    
In [24]:
    
#message box
msgBox = QMessageBox()
msgBox.setText("Hello World " + PySide.__version__)
msgBox.show()
msgBox.exec_()
    
    Out[24]:
In [30]:
    
import sys
import PySide.QtGui
    
In [31]:
    
from PySide.QtGui import QMainWindow, QPushButton, QApplication
    
In [32]:
    
from ui_quitter import Ui_MainWindow
    
In [33]:
    
class MainWindow(QMainWindow, Ui_MainWindow):
    def __init__(self, parent = None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
    
In [11]:
    
#if __name__ =="__main__":
app = QApplication(sys.argv)
    
    
In [34]:
    
frame = MainWindow()
    
In [35]:
    
frame.show()
app.exec_()
sys.exit()
    
    
    
In [ ]:
    
    
In [ ]: