commit
e801a0cbbf
|
@ -256,6 +256,15 @@ class Element():
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def TextClickedHandler(self, event):
|
||||||
|
if self.Key is not None:
|
||||||
|
self.ParentForm.LastButtonClicked = self.Key
|
||||||
|
else:
|
||||||
|
self.ParentForm.LastButtonClicked = self.DisplayText
|
||||||
|
self.ParentForm.FormRemainedOpen = True
|
||||||
|
self.ParentForm.TKroot.quit() # kick the users out of the mainloop
|
||||||
|
|
||||||
|
|
||||||
def ReturnKeyHandler(self, event):
|
def ReturnKeyHandler(self, event):
|
||||||
MyForm = self.ParentForm
|
MyForm = self.ParentForm
|
||||||
button_element = self.FindReturnKeyBoundButton(MyForm)
|
button_element = self.FindReturnKeyBoundButton(MyForm)
|
||||||
|
@ -718,7 +727,7 @@ class Multiline(Element):
|
||||||
# Text #
|
# Text #
|
||||||
# ---------------------------------------------------------------------- #
|
# ---------------------------------------------------------------------- #
|
||||||
class Text(Element):
|
class Text(Element):
|
||||||
def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, relief=None, font=None, text_color=None, background_color=None,justification=None, pad=None, key=None):
|
def __init__(self, text, scale=(None, None), size=(None, None), auto_size_text=None, click_submits=None, relief=None, font=None, text_color=None, background_color=None,justification=None, pad=None, key=None):
|
||||||
'''
|
'''
|
||||||
Text Element - Displays text in your form. Can be updated in non-blocking forms
|
Text Element - Displays text in your form. Can be updated in non-blocking forms
|
||||||
:param text: The text to display
|
:param text: The text to display
|
||||||
|
@ -734,6 +743,7 @@ class Text(Element):
|
||||||
self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR
|
self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR
|
||||||
self.Justification = justification
|
self.Justification = justification
|
||||||
self.Relief = relief
|
self.Relief = relief
|
||||||
|
self.ClickSubmits = click_submits
|
||||||
if background_color is None:
|
if background_color is None:
|
||||||
bg = DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR
|
bg = DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR
|
||||||
else:
|
else:
|
||||||
|
@ -1818,6 +1828,7 @@ class FlexForm:
|
||||||
|
|
||||||
def Layout(self,rows):
|
def Layout(self,rows):
|
||||||
self.AddRows(rows)
|
self.AddRows(rows)
|
||||||
|
return self
|
||||||
|
|
||||||
def LayoutAndRead(self,rows, non_blocking=False):
|
def LayoutAndRead(self,rows, non_blocking=False):
|
||||||
self.AddRows(rows)
|
self.AddRows(rows)
|
||||||
|
@ -2542,6 +2553,9 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
|
||||||
tktext_label.configure(fg=element.TextColor)
|
tktext_label.configure(fg=element.TextColor)
|
||||||
tktext_label.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1], fill='both', expand=True)
|
tktext_label.pack(side=tk.LEFT,padx=element.Pad[0], pady=element.Pad[1], fill='both', expand=True)
|
||||||
element.TKText = tktext_label
|
element.TKText = tktext_label
|
||||||
|
if element.ClickSubmits:
|
||||||
|
tktext_label.bind('<Button-1>', element.TextClickedHandler)
|
||||||
|
|
||||||
# ------------------------- BUTTON element ------------------------- #
|
# ------------------------- BUTTON element ------------------------- #
|
||||||
elif element_type == ELEM_TYPE_BUTTON:
|
elif element_type == ELEM_TYPE_BUTTON:
|
||||||
stringvar = tk.StringVar()
|
stringvar = tk.StringVar()
|
||||||
|
|
Loading…
Reference in New Issue