If this is the wrong place to post bug reports, please let me know the right
place.
wx.calendar.GenericCalendarCtrl and wx.adv.CalendarCtrl both return the
incorrect month number from the GetDate() function.
Both appear to be using a Zero based month list.
When clicking on the 31st December 2017, after calling GetDate() the year
will be 2017 the day will be 31 and the month will be 11.
When clicking on the 1st January 2017, after calling GetDate() the year will
be 2017 the day will be 1 and the month will be 0.
#py3
import wx.adv
#py2
#import wx
#import wx.calendar
class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title='Calendar',size=(300,200))
self.panel = wx.Panel(self)
#py3
self.datepick = wx.adv.CalendarCtrl(self.panel,-1)
self.datepick.Bind(wx.adv.EVT_CALENDAR, self.OnAction)
#py2
#self.datepick = wx.calendar.GenericCalendarCtrl(self.panel,-1)
#self.datepick.Bind(wx.calendar.EVT_CALENDAR, self.OnAction)
self.Show()
def OnAction(self,event):
inp_date = self.datepick.GetDate()
print ("Year Number", inp_date.GetYear())
print ("Month Number", inp_date.GetMonth(),"Month Name",
inp_date.GetMonthName(inp_date.GetMonth()))
print ("Day Numer", inp_date.GetDay())
if __name__ == '__main__':
app = wx.App()
frame = MainFrame()
app.MainLoop()
Running this results in:
<http://wxpython-users.1045709.n5.nabble.com/file/t340556/Screenshot_at_2017-10-20_16-47-32.png>
Is it just me, or does this seem a bit odd?
Regards
Rolf
···
--
Sent from: http://wxpython-users.1045709.n5.nabble.com/