|
本文將展示如何使用基本控件創(chuàng)建簡單的對(duì)話框。主要流程是用戶在QLineEdit中鍵入名字,點(diǎn)擊QPushButton后會(huì)看見問候。
下面這個(gè)小程序?qū)?chuàng)建和顯示對(duì)話框,小程序會(huì)在整個(gè)過程中更新,你可以將這個(gè)程序用在你需要的項(xiàng)目中。

#!/usr/bin/Python
# -*- coding: utf-8 -*-
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("My Form")
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_())
it知識(shí)庫:PySide教程:簡單的對(duì)話框應(yīng)用程序,轉(zhuǎn)載需保留來源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。