Python中用wx.MessageDialog生成对话框,wx.ICON_QUESTION不能显示问号图标。

Python017

Python中用wx.MessageDialog生成对话框,wx.ICON_QUESTION不能显示问号图标。,第1张

import wx

class MyFrame(wx.Frame):

def __init__(self, parent, id):

wx.Frame.__init__(self, parent, id, u'测试面板Panel', size = (600, 300))

#创建面板

panel = wx.Panel(self)

#在Panel上添加Button

button = wx.Button(panel, label = u'关闭', pos = (150, 60), size = (100, 60))

#绑定单击事件

self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button)

def OnCloseMe(self, event):

dlg = wx.MessageDialog(None, u"消息对话框测试", u"标题信息", wx.YES_NO | wx.ICON_QUESTION)

if dlg.ShowModal() == wx.ID_YES:

self.Close(True)

dlg.Destroy()

if __name__ == '__main__':

app = wx.PySimpleApp()

frame = MyFrame(parent = None, id = -1)

frame.Show()

app.MainLoop()

下面这个网站有关于wxpython类的说明文档,相当详细地说明了各个类和相应的方法:

http://wxpython.org/Phoenix/docs/html/index.html

下面这个有所有wxpython类的索引,只简单介绍所有类、方法,可以用来快速查阅控件功能:

http://www.wxpython.org/docs/api/wx-module.html