Merge pull request #6147 from PySimpleGUI/Dev-latest
Added option to enable/disable manual entry
This commit is contained in:
commit
cc08622d06
|
@ -16,7 +16,7 @@ import PySimpleGUI as sg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def popup_get_time(title='Time Entry', starting_hour=1, starting_minute=0, font=None):
|
def popup_get_time(title='Time Entry', starting_hour=1, starting_minute=0, allow_manual_input=True, font=None):
|
||||||
"""
|
"""
|
||||||
Shows a window that will gather a time of day.
|
Shows a window that will gather a time of day.
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@ def popup_get_time(title='Time Entry', starting_hour=1, starting_minute=0, font=
|
||||||
:type starting_hour: int
|
:type starting_hour: int
|
||||||
:param starting_minute: Value to initially show in the minute field
|
:param starting_minute: Value to initially show in the minute field
|
||||||
:type starting_minute: int
|
:type starting_minute: int
|
||||||
|
:param allow_manual_input: If True, then the Spin elements can be manually edited
|
||||||
|
:type allow_manual_input: bool
|
||||||
:param font: Font to use for the window
|
:param font: Font to use for the window
|
||||||
:type font: str | tuple
|
:type font: str | tuple
|
||||||
:return: Tuple with format: (hour, minute, am-pm string)
|
:return: Tuple with format: (hour, minute, am-pm string)
|
||||||
|
@ -36,9 +38,9 @@ def popup_get_time(title='Time Entry', starting_hour=1, starting_minute=0, font=
|
||||||
hour_list = [i for i in range(0, 15)]
|
hour_list = [i for i in range(0, 15)]
|
||||||
minute_list = [i for i in range(-1, 62)]
|
minute_list = [i for i in range(-1, 62)]
|
||||||
|
|
||||||
layout = [[sg.Spin(hour_list, initial_value=starting_hour, key='-HOUR-', s=3, enable_events=True, readonly=False),
|
layout = [[sg.Spin(hour_list, initial_value=starting_hour, key='-HOUR-', s=3, enable_events=True, readonly=not allow_manual_input),
|
||||||
sg.Text(':'),
|
sg.Text(':'),
|
||||||
sg.Spin(minute_list, initial_value=starting_minute, key='-MIN-', s=3, enable_events=True, readonly=False),
|
sg.Spin(minute_list, initial_value=starting_minute, key='-MIN-', s=3, enable_events=True, readonly=not allow_manual_input),
|
||||||
sg.Combo(['AM', 'PM'], 'AM', readonly=True, key='-AMPM-')],
|
sg.Combo(['AM', 'PM'], 'AM', readonly=True, key='-AMPM-')],
|
||||||
[sg.Button('Ok'), sg.Button('Cancel')]]
|
[sg.Button('Ok'), sg.Button('Cancel')]]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue