|
|
@ -1510,64 +1510,64 @@ T = Text
|
|
|
|
# return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color, justification=justification)
|
|
|
|
# return Text(display_text, scale=scale, size=size, auto_size_text=auto_size_text, font=font, text_color=text_color, justification=justification)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- FOLDER BROWSE Element lazy function ------------------------- #
|
|
|
|
# ------------------------- FOLDER BROWSE Element lazy function ------------------------- #
|
|
|
|
def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None):
|
|
|
|
def FolderBrowse(target=(ThisRow, -1), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_BROWSE_FOLDER, target=target, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_BROWSE_FOLDER, target=target, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- FILE BROWSE Element lazy function ------------------------- #
|
|
|
|
# ------------------------- FILE BROWSE Element lazy function ------------------------- #
|
|
|
|
def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None):
|
|
|
|
def FileBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_BROWSE_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- FILES BROWSE Element (Multiple file selection) lazy function ------------------------- #
|
|
|
|
# ------------------------- FILES BROWSE Element (Multiple file selection) lazy function ------------------------- #
|
|
|
|
def FilesBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None):
|
|
|
|
def FilesBrowse(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Browse', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_BROWSE_FILES, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_BROWSE_FILES, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- FILE BROWSE Element lazy function ------------------------- #
|
|
|
|
# ------------------------- FILE BROWSE Element lazy function ------------------------- #
|
|
|
|
def FileSaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None):
|
|
|
|
def FileSaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- SAVE AS Element lazy function ------------------------- #
|
|
|
|
# ------------------------- SAVE AS Element lazy function ------------------------- #
|
|
|
|
def SaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None):
|
|
|
|
def SaveAs(target=(ThisRow, -1), file_types=(("ALL Files", "*.*"),), button_text='Save As...', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_SAVEAS_FILE, target, button_text=button_text, file_types=file_types, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- SAVE BUTTON Element lazy function ------------------------- #
|
|
|
|
# ------------------------- SAVE BUTTON Element lazy function ------------------------- #
|
|
|
|
def Save(button_text='Save', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None):
|
|
|
|
def Save(button_text='Save', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- SUBMIT BUTTON Element lazy function ------------------------- #
|
|
|
|
# ------------------------- SUBMIT BUTTON Element lazy function ------------------------- #
|
|
|
|
def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None):
|
|
|
|
def Submit(button_text='Submit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- OPEN BUTTON Element lazy function ------------------------- #
|
|
|
|
# ------------------------- OPEN BUTTON Element lazy function ------------------------- #
|
|
|
|
def Open(button_text='Open', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None):
|
|
|
|
def Open(button_text='Open', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True,font=None, focus=False, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- OK BUTTON Element lazy function ------------------------- #
|
|
|
|
# ------------------------- OK BUTTON Element lazy function ------------------------- #
|
|
|
|
def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None):
|
|
|
|
def OK(button_text='OK', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color,font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- YES BUTTON Element lazy function ------------------------- #
|
|
|
|
# ------------------------- YES BUTTON Element lazy function ------------------------- #
|
|
|
|
def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None):
|
|
|
|
def Ok(button_text='Ok', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, bind_return_key=True, font=None,focus=False, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- CANCEL BUTTON Element lazy function ------------------------- #
|
|
|
|
# ------------------------- CANCEL BUTTON Element lazy function ------------------------- #
|
|
|
|
def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None):
|
|
|
|
def Cancel(button_text='Cancel', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- QUIT BUTTON Element lazy function ------------------------- #
|
|
|
|
# ------------------------- QUIT BUTTON Element lazy function ------------------------- #
|
|
|
|
def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None):
|
|
|
|
def Quit(button_text='Quit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- Exit BUTTON Element lazy function ------------------------- #
|
|
|
|
# ------------------------- Exit BUTTON Element lazy function ------------------------- #
|
|
|
|
def Exit(button_text='Exit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None):
|
|
|
|
def Exit(button_text='Exit', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None, font=None, bind_return_key=False, focus=False, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- YES BUTTON Element lazy function ------------------------- #
|
|
|
|
# ------------------------- YES BUTTON Element lazy function ------------------------- #
|
|
|
|
def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=True, focus=False, pad=None):
|
|
|
|
def Yes(button_text='Yes', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=True, focus=False, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- NO BUTTON Element lazy function ------------------------- #
|
|
|
|
# ------------------------- NO BUTTON Element lazy function ------------------------- #
|
|
|
|
def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=False, focus=False, pad=None):
|
|
|
|
def No(button_text='No', scale=(None, None), size=(None, None), auto_size_button=None, button_color=None,font=None, bind_return_key=False, focus=False, pad=None, key=None):
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad)
|
|
|
|
return Button(BUTTON_TYPE_CLOSES_WIN, button_text=button_text, scale=scale, size=size, auto_size_button=auto_size_button, button_color=button_color, font=font, bind_return_key=bind_return_key, focus=focus, pad=pad, key=key)
|
|
|
|
|
|
|
|
|
|
|
|
# ------------------------- GENERIC BUTTON Element lazy function ------------------------- #
|
|
|
|
# ------------------------- GENERIC BUTTON Element lazy function ------------------------- #
|
|
|
|
# this is the only button that REQUIRES button text field
|
|
|
|
# this is the only button that REQUIRES button text field
|
|
|
@ -2024,7 +2024,6 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
|
|
|
|
element.TKListbox.insert(tk.END, item)
|
|
|
|
element.TKListbox.insert(tk.END, item)
|
|
|
|
if element.DefaultValues is not None and item in element.DefaultValues:
|
|
|
|
if element.DefaultValues is not None and item in element.DefaultValues:
|
|
|
|
element.TKListbox.selection_set(index)
|
|
|
|
element.TKListbox.selection_set(index)
|
|
|
|
# element.TKListbox.selection_set(0,0)
|
|
|
|
|
|
|
|
if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT:
|
|
|
|
if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT:
|
|
|
|
element.TKListbox.configure(background=element.BackgroundColor)
|
|
|
|
element.TKListbox.configure(background=element.BackgroundColor)
|
|
|
|
if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT:
|
|
|
|
if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT:
|
|
|
@ -2036,6 +2035,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
|
|
|
|
element.TKListbox.pack(side=tk.LEFT)
|
|
|
|
element.TKListbox.pack(side=tk.LEFT)
|
|
|
|
vsb.pack(side=tk.LEFT, fill='y')
|
|
|
|
vsb.pack(side=tk.LEFT, fill='y')
|
|
|
|
listbox_frame.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1])
|
|
|
|
listbox_frame.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1])
|
|
|
|
|
|
|
|
element.TKListbox.bind('<Return>', element.ReturnKeyHandler)
|
|
|
|
# ------------------------- INPUT MULTI LINE element ------------------------- #
|
|
|
|
# ------------------------- INPUT MULTI LINE element ------------------------- #
|
|
|
|
elif element_type == ELEM_TYPE_INPUT_MULTILINE:
|
|
|
|
elif element_type == ELEM_TYPE_INPUT_MULTILINE:
|
|
|
|
default_text = element.DefaultText
|
|
|
|
default_text = element.DefaultText
|
|
|
@ -2183,7 +2183,8 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
|
|
|
|
tkscale.config(highlightthickness=0)
|
|
|
|
tkscale.config(highlightthickness=0)
|
|
|
|
if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT:
|
|
|
|
if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT:
|
|
|
|
tkscale.configure(background=element.BackgroundColor)
|
|
|
|
tkscale.configure(background=element.BackgroundColor)
|
|
|
|
tkscale.config(troughcolor=DEFAULT_SCROLLBAR_COLOR)
|
|
|
|
if DEFAULT_SCROLLBAR_COLOR != COLOR_SYSTEM_DEFAULT:
|
|
|
|
|
|
|
|
tkscale.config(troughcolor=DEFAULT_SCROLLBAR_COLOR)
|
|
|
|
if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT:
|
|
|
|
if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT:
|
|
|
|
tkscale.configure(fg=text_color)
|
|
|
|
tkscale.configure(fg=text_color)
|
|
|
|
tkscale.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1])
|
|
|
|
tkscale.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1])
|
|
|
@ -2948,10 +2949,21 @@ GetFile = GetFileBox
|
|
|
|
AskForFile = GetFileBox
|
|
|
|
AskForFile = GetFileBox
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def PopupGetFile(message, default_path='', file_types=(("ALL Files", "*.*"),), button_color=None, size=(None, None)):
|
|
|
|
def PopupGetFile(message, save_as=False, no_window=False, default_path='', file_types=(("ALL Files", "*.*"),), button_color=None, size=(None, None)):
|
|
|
|
|
|
|
|
if no_window:
|
|
|
|
|
|
|
|
if save_as:
|
|
|
|
|
|
|
|
return tk.filedialog.asksaveasfilename(filetypes=file_types) # show the 'get file' dialog box
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return tk.filedialog.askopenfilename(filetypes=file_types) # show the 'get file' dialog box
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if save_as:
|
|
|
|
|
|
|
|
browse_button = SaveAs(file_types=file_types)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
browse_button = FileBrowse(file_types=file_types)
|
|
|
|
|
|
|
|
|
|
|
|
with FlexForm(title=message, auto_size_text=True, button_color=button_color) as form:
|
|
|
|
with FlexForm(title=message, auto_size_text=True, button_color=button_color) as form:
|
|
|
|
layout = [[Text(message, auto_size_text=True)],
|
|
|
|
layout = [[Text(message, auto_size_text=True)],
|
|
|
|
[InputText(default_text=default_path, size=size), FileBrowse(file_types=file_types)],
|
|
|
|
[InputText(default_text=default_path, size=size), browse_button],
|
|
|
|
[Ok(), Cancel()]]
|
|
|
|
[Ok(), Cancel()]]
|
|
|
|
|
|
|
|
|
|
|
|
(button, input_values) = form.LayoutAndRead(layout)
|
|
|
|
(button, input_values) = form.LayoutAndRead(layout)
|
|
|
@ -2961,6 +2973,7 @@ def PopupGetFile(message, default_path='', file_types=(("ALL Files", "*.*"),), b
|
|
|
|
path = input_values[0]
|
|
|
|
path = input_values[0]
|
|
|
|
return path
|
|
|
|
return path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================== GetTextBox =========#
|
|
|
|
# ============================== GetTextBox =========#
|
|
|
|
# Get a single line of text #
|
|
|
|
# Get a single line of text #
|
|
|
|
# ===================================================#
|
|
|
|
# ===================================================#
|
|
|
|