I might be doing the wrong thing here, but would like to know the answer anyway.
I am attempting to sub-class wx.calendar.CalendarCtrl and create a widget that has a couple of buttons (forward and backwards) that allow traversing the calendar in equal day jumps. But I am not sure how I can get the sizers arranged to show the calendar and the buttons i.e. the following gives me a calendar with the buttons overlaying the calendar. If I add ‘sizer.Add(self)’ then I lose sight of the buttons and just have the calendar.
What is the correct way to do this please?
Thanks for the help!
Peter
class Calendar (wx.calendar.CalendarCtrl):
“”" “”"
def init (self, *args, **kwargs):
wx.calendar.CalendarCtrl.init(self, *args, **kwargs)
self.Bind(wx.calendar.EVT_CALENDAR_SEL_CHANGED, self.OnDateChange)
forward = wx.Button(self, -1, ‘Next->’)
backward = wx.Button(self, -1, ‘<-Prev’)
self.Bind(wx.EVT_BUTTON, self.OnForward, forward)
self.Bind(wx.EVT_BUTTON, self.OnBackward, backward)
ButtonSizer = wx.BoxSizer(wx.HORIZONTAL)
ButtonSizer.Add(forward)
ButtonSizer.Add(backward)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(ButtonSizer,0,wx.CENTER)
self.SetSizer(sizer)
self.Fit()