Форум сайта python.su
Всем привет.
Есть код:
# -*- coding: cp1251 -*-
import wx
class Panel(wx.Panel):
def __init__(self, parent, *args, **kwargs):
wx.Panel.__init__(self, parent, *args, **kwargs)
sizer = wx.BoxSizer(wx.VERTICAL)
self.dat = wx.DatePickerCtrl(self, style=wx.DP_DROPDOWN)
sizer.Add(self.dat)
self.SetSizer(sizer)
wx.EVT_DATE_CHANGED(self.dat, self.dat.GetId(), self.DateChanged)
def DateChanged(self, evt):
wx.MessageBox('message text', 'message caption', wx.ICON_ERROR|wx.OK, self)
class MainFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent)
self.panel = Panel(self)
class App(wx.App):
def __init__(self):
wx.App.__init__(self)
# wx.App.__init__(self, True, 'log.txt')
frame = MainFrame(None)
frame.Show(True)
if __name__ == "__main__":
app = App()
app.MainLoop()
# -*- coding: cp1251 -*-
import wx
class Panel(wx.Panel):
def __init__(self, parent, *args, **kwargs):
wx.Panel.__init__(self, parent, *args, **kwargs)
sizer = wx.BoxSizer(wx.VERTICAL)
self.dat = wx.DatePickerCtrl(self, style=wx.DP_DROPDOWN)
sizer.Add(self.dat)
self.SetSizer(sizer)
wx.EVT_DATE_CHANGED(self.dat, self.dat.GetId(), self.DateChanged)
def show_mes(self, text):
wx.MessageBox(text,'message caption', wx.ICON_ERROR|wx.OK, self)
def DateChanged(self, evt):
wx.CallAfter(self.show_mes, 'message text')
class MainFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent)
self.panel = Panel(self)
class App(wx.App):
def __init__(self):
wx.App.__init__(self)
# wx.App.__init__(self, True, 'log.txt')
frame = MainFrame(None)
frame.Show(True)
if __name__ == "__main__":
app = App()
app.MainLoop()
Офлайн