Search code examples
pythonwxpython

WxPhyton DatePickerCtrl not selectable


I am constructing an wx.DatePickerCtrl by:

 self.DateTimePicker = wx.DatePickerCtrl(self, size=(100,-1), style = wx.DP_DROPDOWN |wx.DP_SHOWCENTURY)
 self.DateTimePicker.SetToolTipString("Select date of creation")
 self.Bind(wx.EVT_DATE_CHANGED, self.__OnDateTimePickerClicked, self.DateTimePicker)

with an Function called by the DateChanged Event.
But when I construct my Window and want to click to the DatePicker, it is not clickable. Can someone fix this problem?


Solution

  • you are doing something wrong (somewhere else ... is there something covering it?)

    import wx
    class Blah(wx.Frame):
        def __init__(self,*args,**kwargs):
            wx.Frame.__init__(self,*args,**kwargs)
            self.DateTimePicker = wx.DatePickerCtrl(self, size=(100,-1), style = wx.DP_DROPDOWN |wx.DP_SHOWCENTURY)
            self.DateTimePicker.SetToolTipString("Select date of creation")
            self.Bind(wx.EVT_DATE_CHANGED, self.__OnDateTimePickerClicked, self.DateTimePicker)
    
        def __OnDateTimePickerClicked(self,e):
            e.Skip()
    
    
    a = wx.App(redirect=False)
    f = Blah(None,-1,"ASDASDASDASDASD")
    f.Show()
    a.MainLoop()
    

    really if you want to get help you will need to demonstrate with (minimal)example code that actually behaves the way you claim (eg my example which you can just copy and paste to a py file and see that you can indeed click the button)