Added new force parameter to all SetFocus calls. Removed calls to WM_DESTROY due to memory leak
This commit is contained in:
parent
6c3da863d3
commit
9cce12e8c2
|
@ -704,9 +704,12 @@ class InputText(Element):
|
||||||
text = ''
|
text = ''
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def SetFocus(self):
|
def SetFocus(self, force=False):
|
||||||
""" """
|
""" """
|
||||||
try:
|
try:
|
||||||
|
if force:
|
||||||
|
self.TKEntry.focus_force()
|
||||||
|
else:
|
||||||
self.TKEntry.focus_set()
|
self.TKEntry.focus_set()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
@ -1023,9 +1026,12 @@ class Listbox(Element):
|
||||||
""" """
|
""" """
|
||||||
return self.Values
|
return self.Values
|
||||||
|
|
||||||
def SetFocus(self):
|
def SetFocus(self, force=False):
|
||||||
""" """
|
""" """
|
||||||
try:
|
try:
|
||||||
|
if force:
|
||||||
|
self.TKListbox.focus_force()
|
||||||
|
else:
|
||||||
self.TKListbox.focus_set()
|
self.TKListbox.focus_set()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
@ -1405,13 +1411,17 @@ class Multiline(Element):
|
||||||
""" """
|
""" """
|
||||||
return self.TKText.get(1.0, tk.END)
|
return self.TKText.get(1.0, tk.END)
|
||||||
|
|
||||||
def SetFocus(self):
|
def SetFocus(self, force=False):
|
||||||
""" """
|
""" """
|
||||||
try:
|
try:
|
||||||
|
if force:
|
||||||
|
self.TKText.focus_force()
|
||||||
|
else:
|
||||||
self.TKText.focus_set()
|
self.TKText.focus_set()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
""" """
|
""" """
|
||||||
super().__del__()
|
super().__del__()
|
||||||
|
@ -2082,13 +2092,17 @@ class Button(Element):
|
||||||
""" """
|
""" """
|
||||||
return self.ButtonText
|
return self.ButtonText
|
||||||
|
|
||||||
def SetFocus(self):
|
def SetFocus(self, force=False):
|
||||||
""" """
|
""" """
|
||||||
try:
|
try:
|
||||||
|
if force:
|
||||||
|
self.TKButton.focus_force()
|
||||||
|
else:
|
||||||
self.TKButton.focus_set()
|
self.TKButton.focus_set()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def Click(self):
|
def Click(self):
|
||||||
"""Generates a click of the button as if the user clicked the button
|
"""Generates a click of the button as if the user clicked the button
|
||||||
:return:
|
:return:
|
||||||
|
@ -2881,10 +2895,16 @@ class Graph(Element):
|
||||||
if self.ParentForm.CurrentlyRunningMainloop:
|
if self.ParentForm.CurrentlyRunningMainloop:
|
||||||
self.ParentForm.TKroot.quit() # kick out of loop if read was called
|
self.ParentForm.TKroot.quit() # kick out of loop if read was called
|
||||||
|
|
||||||
def SetFocus(self):
|
def SetFocus(self, force=False):
|
||||||
""" """
|
""" """
|
||||||
|
try:
|
||||||
|
if force:
|
||||||
|
self._TKCanvas2.focus_force()
|
||||||
|
else:
|
||||||
self._TKCanvas2.focus_set()
|
self._TKCanvas2.focus_set()
|
||||||
# self._TKCanvas2.focus_force()
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
""" """
|
""" """
|
||||||
|
@ -4852,8 +4872,8 @@ class Window:
|
||||||
self.TKAfterID = self.TKroot.after(timeout, self._TimeoutAlarmCallback)
|
self.TKAfterID = self.TKroot.after(timeout, self._TimeoutAlarmCallback)
|
||||||
self.CurrentlyRunningMainloop = True
|
self.CurrentlyRunningMainloop = True
|
||||||
# print(f'In main {self.Title} {self.TKroot}')
|
# print(f'In main {self.Title} {self.TKroot}')
|
||||||
self.TKroot.protocol("WM_DESTROY_WINDOW", self.OnClosingCallback)
|
# self.TKroot.protocol("WM_DESTROY_WINDOW", self.OnClosingCallback)
|
||||||
self.TKroot.protocol("WM_DELETE_WINDOW", self.OnClosingCallback)
|
# self.TKroot.protocol("WM_DELETE_WINDOW", self.OnClosingCallback)
|
||||||
self.TKroot.mainloop()
|
self.TKroot.mainloop()
|
||||||
# print('Out main')
|
# print('Out main')
|
||||||
self.CurrentlyRunningMainloop = False
|
self.CurrentlyRunningMainloop = False
|
||||||
|
|
Loading…
Reference in New Issue