DatePickerCtrl crashes on windows - Invalid date in wxDateTime::Set()
Luís Carvalho <[email protected]>
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'm trying to use a DatePickerCtrl, but I cannot create one unless I use
the style DP_ALLOWNONE.
The only way I can use one is if I set DP_ALLOWNONE, and then use SetRange.
Otherwise it crashes the app with:
wx._core.PyAssertionError: C++ assertion "(0 < day) && (day <=
GetNumberOfDays(month, year))" failed at
..\..\src\common\datetime.cpp(1221) in wxDateTime::Set(): Invalid date in
wxDateTime::Set()
import wx
app = wx.App()
frame = wx.Frame(parent=None, title='Test')
# Crashes
wx.DatePickerCtrl(frame, wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition,
wx.Size( 105, -1 ), wx.DP_DROPDOWN)
# Crashes
wx.DatePickerCtrl(frame, wx.ID_ANY, wx.DateTimeFromDMY(1, wx.DateTime.Jan,
2010),
wx.DefaultPosition, wx.Size( 105, -1 ),
wx.DP_DROPDOWN|wx.DP_ALLOWNONE)
# OK
dp = wx.DatePickerCtrl(frame, wx.ID_ANY, wx.DefaultDateTime, wx.
DefaultPosition,
wx.Size( 105, -1 ), wx.DP_DROPDOWN|wx.DP_ALLOWNONE)
# But then setting any value crashes
dp.SetValue(wx.DateTimeFromDMY(1, wx.DateTime.Jan, 2010))
# However, if we set range first
dp.SetRange(wx.DateTimeFromDMY(1, wx.DateTime.Jan, 2000), wx.DefaultDateTime
)
# Then it's OK
dp.SetValue(wx.DateTimeFromDMY(1, wx.DateTime.Jan, 2010))
frame.Show(True)
app.MainLoop()
Everything worked fine in wxPython 2.8. I tried 3.0.2 and 3.0.3 and get the
same results. It works fine on Linux.
Also,I'm using Python 2.7.
Does anyone have any idea on how I can work around this?
Thanks
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.