From 194c053f129e6a6fa26c7c7447ccc25813b3fe9c Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Tue, 31 Mar 2020 08:25:38 -0400 Subject: [PATCH] Quick switch back to previous way of getting month & day names for get_date --- PySimpleGUI.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 64cd8e16..c422dcff 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 -version = __version__ = "4.18.0.5 Unreleased - Print and MLine.Print fixed sep char handling, popup_get_date, icon parm popup_animated, popup button size (6,1), NEW CALENDAR chooser integrated" +version = __version__ = "4.18.0.6 Unreleased - Print and MLine.Print fixed sep char handling, popup_get_date, icon parm popup_animated, popup button size (6,1), NEW CALENDAR chooser integrated" port = 'PySimpleGUI' @@ -14341,16 +14341,27 @@ def popup_get_date(start_mon=None, start_day=None, start_year=None, begin_at_su return days_layout - def get_month_name(month_no, locale): - with calendar.different_locale(locale): - return calendar.month_name[month_no] + # def get_month_name(month_no, locale): + # with calendar.different_locale(locale): + # return calendar.month_name[month_no] + # + # def get_day_name(day_no, locale): + # with calendar.different_locale(locale): + # return calendar.day_abbr[day_no] + # + # month_names = [get_month_name(month, locale) for month in range(1,13)] + # day_names = [get_day_name(day, locale) for day in range(0,7)] - def get_day_name(day_no, locale): - with calendar.different_locale(locale): - return calendar.day_abbr[day_no] + # Create table of month names and week day abbreviations + fwday = calendar.MONDAY + if locale is not None: + _cal = calendar.LocaleTextCalendar(fwday, locale) + else: + _cal = calendar.TextCalendar(fwday) - month_names = [get_month_name(month, locale) for month in range(1,13)] - day_names = [get_day_name(day, locale) for day in range(0,7)] + day_names = _cal.formatweekheader(3).split() + + month_names= [calendar.month_name[i] for i in range(7)] days_layout = make_days_layout()