如下所示:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
from pyqt4 import qtgui,qtcore import sys class web_browser(qtgui.qdialog): def __init__( self ,parent = none): qtgui.qwidget.__init__( self ) self .resize( 550 , 400 ) open = qtgui.qpushbutton( 'open' ) self .connect( open ,qtcore.signal( 'clicked()' ), self .ok) grid = qtgui.qgridlayout() grid.addwidget( open , 1 , 0 , 1 , 1 ) self .setlayout(grid) self .setwindowtitle( 'main windows' ) def ok( self ): web = web_browser() web.setmodal(false) web.setwindowtitle( 'sub window' ) web.exec_() app = qtgui.qapplication(sys.argv) app.setfont(qtgui.qfont( "helvetica" , 16 )) main = web_browser() main.show() sys.exit(app.exec_()) |
以上这篇pyqt弹出新对话框,以及关闭对话框获取数据的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/a6225301/article/details/43313595