zoukankan      html  css  js  c++  java
  • python类库26[PySide之helloworld]


    PySide

    website : http://www.pyside.org/

    onlinedoc :http://www.pyside.org/docs/pyside/ 

    wiki:http://developer.qt.nokia.com/wiki/PySideDocumentation/ 

    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

    python2.6 win32 :http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi

    PySide win32 :http://pypi.python.org/packages/2.6/P/PySide/PySide-1.0.0qt472.win32-py2.6.exe

    二 简单实例

    代码:

     
    # Import PySide classes
    import sys
    from PySide.QtCore import *
    from PySide.QtGui import *
     
    class Form(QDialog):
         
        
    def __init__(self, parent=None):
            super(Form, self).
    __init__(parent)
            self.setWindowTitle(
    "iTech's Blog"
     
            
    # 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.cnblogs.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_())

    结果:

    三 更多 examples

    下载所有的examples(http://qt.gitorious.org/pyside/pyside-examples/trees/master ),然后解压到C:\Python26\pyside-pyside-examples。

    执行C:\Python26\pyside-pyside-examples\examples\demos\qtdemo> python qtdemo.py 来查看所有的demo。 如下图:

     

    参考: 

    PyQT : http://www.riverbankcomputing.co.uk/news

    Rapid.GUI.Programming.with.Python.and.Qt.Oct.2007

    完!

  • 相关阅读:
    test
    【转载】ASP.NET MVC 3 —— Model远程验证
    【转载】富有客户端技术之——jQuery EasyUI
    【转载】基于ASP.NET Web Application的插件实现,附DEMO
    【转载】浅谈C#中的延迟加载(1)——善用委托
    【转载】Winform开发框架之权限管理系统
    【转载】基于我的Winform开发框架扩展而成的WCF开发框架
    [转载]10大优秀的移动Web应用程序开发框架推荐
    [转载]C#泛型列表List<T>基本用法总结
    [转载]推荐一个被大家忽视的微软的反跨站脚本库AntiXSS V3.1
  • 原文地址:https://www.cnblogs.com/itech/p/1995598.html
Copyright © 2011-2022 走看看