wxPython ダイアログを表示してみる
wxPythonで簡単なダイアログを表示してみる。
#!/usr/bin/env python #coding:utf-8 import wx class MyWindow(wx.Frame): def __init__(self,parent,id): wx.Frame.__init__(self,parent,id,"MyTitle",size=(300,200)) panel=wx.Panel(self) button=wx.Button(panel,label="exit",pos=(130,10),size=(60,60)) button2=wx.Button(panel,label="dialog",pos=(130,70),size=(60,60)) self.Bind(wx.EVT_BUTTON, self.closebutton, button) self.Bind(wx.EVT_BUTTON, self.dialogbutton, button2) def closebutton(self,event): self.Close(True) def dialogbutton(self,event): box=wx.MessageDialog(None,'Do you see me?','MyDialog',wx.OK) anser=box.ShowModal() if __name__=='__main__': app=wx.PySimpleApp() frame=MyWindow(parent=None,id=-1) frame.Show() app.MainLoop()