A request to @steve2 and @Rushin
For the purposes of trying to tie down the bug, which I can’t replicate, it would be interesting to know if using minidatepickerbutton.py or minidatepicker.py without wx.adv.CAL_SEQUENTIAL_MONTH_SELECTION, whether you can change the month with the keyboard i.e. the up/down arrow keys and the PageUp/PageDown keys.
The reason:
It would test if the month is populated properly and tie the error down to the EVT_CHOICE not being fired on the m_choiceMonth widget, however unlikely that seems.
The changes made to calctrlg.cpp appear to be related displaying month names in different languages. This made me wonder if the issue on Windows is related to locale.
@steve2 has said that the example in the wxPython demo does work correctly. I remembered that the demo explicitly sets a locale in its Main.py module:
In the current unpublished version of minidatepicker and minidatepickerbutton, I’ve used that dictionary method, as inspiration to provide functions to mark holidays, mark specific dates which aren’t holidays, create notes that can be displayed with a Right Click and Restrict dates, making only defined dates and or days selectable.
I do hope you don’t mind but inspiration is inspiration!
Thanks for coming back to me @steve2.
I’m assuming that’s in some standalone code of your own. If so, then it is in fact a bug, that’s worked its way into the MS Windows version of the code.
I guess the answer for now, on Windows, is to use the wx.adv.CAL_SEQUENTIAL_MONTH_SELECTION
Out of interest, did you check @RichardT 's suggestion, about setting a locale?
I’ve got a new version, I’m just about fed up to the backteeth with, testing wise, usually a sign to release it so if the dropdown month selection is something I can do nothing about, I’d like to get it out and stop torturing myself with it.
I think the problem is related to wx.PopupTransientWindow. It doesn’t let the drop down menu show up. Instead of wx.PopupTransientWindow, if you use wx.Frame, the drop down menu works fine.
wx.PU_CONTAINS_CONTROLS : By default in wxMSW, a popup window will not take focus from its parent window. However many standard controls, including common ones such as wx.TextCtrl, need focus to function correctly and will not work when placed on a default popup. This flag can be used to make the popup take focus and let all controls work but at the price of not allowing the parent window to keep focus while the popup is shown, which can also be sometimes desirable. This style is currently only implemented in MSW and simply does nothing under the other platforms (it’s new since wxWidgets 3.1.3).
Find the def OnCalendar(self, _event=None): definition and replace it with this:
def OnCalendar(self, _event=None):
if self._pop:
return
self._pop = True # controls only one popup at any one time
self.calendar = CalendarPopup(
self, self._date, self.OnDate, self.GetTopLevelParent(), wx.PU_CONTAINS_CONTROLS|wx.SIMPLE_BORDER)
pos = self.ClientToScreen((0, 0))
size = self.GetSize()
self.calendar.Position(pos, (0, size.height))
Then remove the wx.adv.CAL_SEQUENTIAL_MONTH_SELECTION from the styles of self.mdp
That should do it!
If it does I’ll include in the next version.
As you’ll see, it’s an wxMSW only issue, so thanks for tracking that down for me.
Version 1.5 of minidatepicker and minidatepickerbutton
Changelog:
1.5 Add optional holidays package
A fast, efficient Python library for generating country and subdivision- (e.g. state or province) specific
sets of government-designated holidays on the fly.
Alter the font_family, weight, size etc of the calendar popup
New functions:
AddOfficialHolidays - to add Official holiday zones using 'python holidays package'
SetCalendarFont() - Change calendar font_family, weight, style, size etc
Fix for MSW, added style wx.PU_CONTAINS_CONTROLS to the Popup, which allows the month choice drop down
to function
1.4 New Functions
SetCalendarHolidayColours
SetCalendarHolidays
SetCalendarMarkBorder
SetCalendarMarkDates
Permit the definition of Holidays and key dates to be highlighted and the method of highlighting;
by colour for holidays and border type, plus border colour, for marked days
SetCalendarDateRange
allows the restriction of dates to a range, that can be selected
SetCalendarNotes
Allows for notes to be assigned to individual days in the calendar.
If notes exist for a day, when hovered over the ToolTip will display the note.
Envisaged to be used in conjunction with Holidays and Marked days to provide detail
SetCalendarRestrictDates
Set a dictionary of dates that are Not selectable
SetCalendarOnlyWeekDays
Only weekdays are selectable i.e. weekends and holidays are not
Navigation:
The Escape key will exit the Calendar
The Arrow keys will navigate the calendar
The PageUp/PageDown keys will retreat and advance and the month respectively, as will MouseScrollUp and MouseScrollDown
The Home and End keys jump to the First and Last day of the month, respectively.
A right click on the calendar on a blank day, will display All the notes for the month.
Date ToolTips will be displayed as and when appropriate, depending of the position in the calendar and settings
I’ll take a look at it. I recall telling everyone that the python/wxPython datetime thing was screwed up at one time and to just copy all the wx modules functions into a blank skeleton and try to rewrite them in pure python. Looks like you started on that, tho my hopes are not up as for like the last eternity there is always been some small sort of bug with the two working together and it completely screws up my DeltaTime class, which by the way is NOT a format lol.