# -*- coding: gbk -*-
import wx
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self,parent=None,id=-1,title="python你好",size=(600,500))
self.panel = wx.Panel(self)
self.button = wx.Button(self.panel,label="确定退出",pos=(200,100),size=(80,60))
self.Bind(wx.EVT_BUTTON,self.btClose,self.button)
def btClose(self,event):
dlg = wx.MessageDialog(parent=None,
message="你真的要退出吗?",
caption="请选择",
style=wx.YES_NO)
if dlg.ShowModal() == wx.ID_YES:
self.Close(True)
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = MyFrame()
frame.Show()
app.MainLoop()p
|