I have two classes in wxpython, a wx.Frame class and a wx.Dialog (calendar dialog) class
My calendar dialog looks like this:
class Calendar(wx.Dialog):
def __init__(self, parent, id, title):
wx.Dialog.__init__(self, parent, id, title)
vbox = wx.BoxSizer(wx.VERTICAL)
self.calend = cal.CalendarCtrl(self, -1, wx.DateTime_Now(),
style = cal.CAL_SHOW_HOLIDAYS|cal.CAL_SEQUENTIAL_MONTH_SELECTION)
vbox.Add(self.calend, 0, wx.EXPAND | wx.ALL, 20)
vbox.Add((-1, 20))
hbox2 = wx.BoxSizer(wx.HORIZONTAL)
btn = wx.Button(self, -1, 'Ok')
cancelBtn = wx.Button(self, -1, 'Cancel')
hbox2.Add(btn, 1)
hbox2.Add(cancelBtn, 1)
vbox.Add(hbox2, 0, wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, 20)
btn.Bind(wx.EVT_BUTTON, self.okClicked)
cancelBtn.Bind(wx.EVT_BUTTON, self.OnQuit)
self.SetSizerAndFit(vbox)
self.Show(True)
self.Centre()
def okClicked(self, event):
date = self.calend.GetDate()
print date
return date
And I call the calendar dialog from my frame class like so
def calClick1(self, event):
calObj = Calendar(None, -1, 'test cal')
calObj.ShowModal()
#here i want to set the returned date to a wx.TextCtrl
How do I set the value of a TextCtrl box in my wx.Frame class to the returned date in the calendar dialog class?