:param elem: :type elem: :return: :rtype:
(self, elem)
| 10539 | self.TKroot.quit() # kick the users out of the mainloop |
| 10540 | |
| 10541 | def _calendar_chooser_button_clicked(self, elem): |
| 10542 | """ |
| 10543 | |
| 10544 | :param elem: |
| 10545 | :type elem: |
| 10546 | :return: |
| 10547 | :rtype: |
| 10548 | """ |
| 10549 | target_element, strvar, should_submit_window = elem._find_target() |
| 10550 | |
| 10551 | if elem.calendar_default_date_M_D_Y == (None, None, None): |
| 10552 | now = datetime.datetime.now() |
| 10553 | cur_month, cur_day, cur_year = now.month, now.day, now.year |
| 10554 | else: |
| 10555 | cur_month, cur_day, cur_year = elem.calendar_default_date_M_D_Y |
| 10556 | |
| 10557 | date_chosen = popup_get_date(start_mon=cur_month, start_day=cur_day, start_year=cur_year, close_when_chosen=elem.calendar_close_when_chosen, |
| 10558 | no_titlebar=elem.calendar_no_titlebar, begin_at_sunday_plus=elem.calendar_begin_at_sunday_plus, |
| 10559 | locale=elem.calendar_locale, location=elem.calendar_location, month_names=elem.calendar_month_names, |
| 10560 | day_abbreviations=elem.calendar_day_abbreviations, title=elem.calendar_title) |
| 10561 | if date_chosen is not None: |
| 10562 | month, day, year = date_chosen |
| 10563 | now = datetime.datetime.now() |
| 10564 | hour, minute, second = now.hour, now.minute, now.second |
| 10565 | try: |
| 10566 | date_string = calendar.datetime.datetime(year, month, day, hour, minute, second).strftime(elem.calendar_format) |
| 10567 | except Exception as e: |
| 10568 | print('Bad format string in calendar chooser button', e) |
| 10569 | date_string = 'Bad format string' |
| 10570 | |
| 10571 | if target_element is not None and target_element != elem: |
| 10572 | target_element.update(date_string) |
| 10573 | elif target_element == elem: |
| 10574 | elem.calendar_selection = date_string |
| 10575 | |
| 10576 | strvar.set(date_string) |
| 10577 | elem.TKStringVar.set(date_string) |
| 10578 | if should_submit_window: |
| 10579 | self.LastButtonClicked = target_element.Key |
| 10580 | results = _BuildResults(self, False, self) |
| 10581 | else: |
| 10582 | should_submit_window = False |
| 10583 | return should_submit_window |
| 10584 | |
| 10585 | # @_timeit_summary |
| 10586 | def read(self, timeout=None, timeout_key=TIMEOUT_KEY, close=False): |
no test coverage detected