What is the difference between a native wx.datepicker control and a generic wx.datepicker control

Good day all,

I have been digging down the net but I can’t seem to find a good explanation that can help me. I am a visually impaired coder and I would love for someone to explain the difference between a native wx.datepicker control and a generic wx.datepicker control.
Along with that, I would like to know:

  1. If i create them both, would they show up as two different widgets?
  2. which one of them would allow me to change the format of the control(for instance if i wanted January to be shown instead of 01)
  3. also I would like to know if there is a way that I could just extract the month selected by the control so I could print it elsewhere.
    Thank you.

I have not much experience with the datepicker controls, but usually the difference between the generic and the standard version is the implementation.

The standard versions are the ones provided by your operating system.

The generic versions are implemented via basic wx or wxPython widgets or the screen painting is handled by wx or wxPython. If you use an inspection tool or a screen reader, you may see different widgets. E.g. for the date pickers NVDA is telling me ‘combobox’ for the generic version. On Mac or Linux this could be different.
I can retrieve the combo box via GetChildren()[0].

If your OS does not have a standard implementation, then wx should fall back to the generic implementation.

So, if you need the same look and feel on all your platforms, use the generic versions.
Usually you want platform specific look and feel and therefore you will use the standard version.

You should be able to extract the month from the widget or the DateEvent.
E.g. self.datepicker.GetValue().GetMonth() should return 0 for January and 1 for February.

I don’t think you can customize the display in the way you want as the ‘SetFormat’ method is not exposed.
With the generic version you may use code like this, though:

combobox = self.datepicker.GetChildren()[0]
combobox.SetValue("01. January 2022")

If this does not work or has unwanted side effects, you need to implement your own version.
For the C++ implementation see here:

https://github.com/wxWidgets/wxWidgets/blob/204db7e76a8359ad76366de273e146d8566ac3e2/src/generic/datectlg.cpp

https://github.com/wxWidgets/wxWidgets/blob/204db7e76a8359ad76366de273e146d8566ac3e2/include/wx/generic/datectrl.h

Regards,
Dietmar

thank you very much you have been a big help.