sourcecode:http://qt.gitorious.org/pyside/
example :http://qt.gitorious.org/pyside/pyside-examples/trees/master (看了example后一切就都太简单了)
The PySide project provides LGPL-licensed Python bindings for the Qt cross-platform application and UI framework, as well as a complete toolchain for rapidly generating bindings for any Qt-based C++ class hierarchies. PySide Qt bindings allow both free open source and proprietary software development and ultimately aim to support all of the platforms as Qt itself.
一 安装python和pyside
# Create widgets
self.edit = QLineEdit("Write your name here")
self.button = QPushButton("Welcome to my blog")
# Create layout and add widgets
layout = QVBoxLayout()
layout.addWidget(self.edit)
layout.addWidget(self.button)
# Set dialog layout
self.setLayout(layout)
# Add button signal to welcome slot
self.button.clicked.connect(self.welcome)
# Welcome to the user
def welcome(self):
print ("%s, Welcome to my blog[http://itech.iyunv.com]! " % self.edit.text())
if __name__ == '__main__':
# Create the Qt Application
app = QApplication(sys.argv)
# Create and show the form
form = Form()
form.show()
# Run the main Qt loop
sys.exit(app.exec_()) 结果: