哪位能否指导一下DatePickerCtrl的用法,谢谢

哪位能否指导一下DatePickerCtrl的用法,谢谢

我的代码如下:

[Copy to clipboard] [ - ]
CODE:
self.edtDate = wx.DatePickerCtrl(self, pos = (65, 20), size = (100, -1), style = wx.DP_DROPDOWN | wx.DP_SHOWCENTURY)
dateStr = self.edtDate.GetValue().Format('%Y%m%d')

但得到的错误如下
x._core.PyAssertionError: C++ assertion "m_date.IsValid() == dt.IsValid() && (!dt.IsValid() || dt == m_date)" failed at ..\..\src\msw\datectrl.cpp(272) in wxDatePickerCtrl::GetValue(): bug in wxDatePickerCtrl: m_date not in sync
这是什么原因呢?


[Copy to clipboard] [ - ]
CODE:
self.edtDate = wx.DatePickerCtrl(self, pos = (65, 20), size = (120, -1), style = wx.DP_SHOWCENTURY | wx.DP_DROPDOWN)
self.Bind(wx.EVT_DATE_CHANGED, self.OnCalSelChanged, self.edtDate)
...
def OnCalSelChanged(self, evt):
        cal = evt.GetEventObject()
        datestr = cal.GetValue()
        print datestr.Format('%Y%m%d')

这样就可以实现我的功能了