Merge pull request #5526 from PySimpleGUI/Dev-latest

Fix for continuous mouse up events from Graph element when reading wi…
This commit is contained in:
PySimpleGUI 2022-05-29 18:58:02 -04:00 committed by GitHub
commit ad5b82654f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 12 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
version = __version__ = "4.60.0.14 Unreleased" version = __version__ = "4.60.0.15 Unreleased"
_change_log = """ _change_log = """
Changelog since 4.60.0 released to PyPI on 8-May-2022 Changelog since 4.60.0 released to PyPI on 8-May-2022
@ -40,6 +40,8 @@ _change_log = """
Added Window.unbind Added Window.unbind
4.60.0.14 4.60.0.14
Added (None, None) to the Window docstring Added (None, None) to the Window docstring
4.60.0.15
Fix for continuous Graph element mouse up events when reading with a timeout=0. Big thank you to @davesmivers (THANKS DAVE!!) for finding and fixing
""" """
__version__ = version.split()[0] # For PEP 396 and PEP 345 __version__ = version.split()[0] # For PEP 396 and PEP 345
@ -6468,25 +6470,22 @@ class Graph(Element):
:param event: (event) event info from tkinter. Note not used in this method :param event: (event) event info from tkinter. Note not used in this method
:type event: :type event:
""" """
if not self.DragSubmits: # only report mouse up for drag operations if not self.DragSubmits:
return return # only report mouse up for drag operations
self.ClickPosition = self._convert_canvas_xy_to_xy(event.x, event.y) self.ClickPosition = self._convert_canvas_xy_to_xy(event.x, event.y)
self.LastButtonClickedWasRealtime = not self.DragSubmits self.ParentForm.LastButtonClickedWasRealtime = False
if self.Key is not None: if self.Key is not None:
self.ParentForm.LastButtonClicked = self.Key self.ParentForm.LastButtonClicked = self.Key
else: else:
self.ParentForm.LastButtonClicked = '__GRAPH__' # need to put something rather than None self.ParentForm.LastButtonClicked = '__GRAPH__' # need to put something rather than None
# if self.ParentForm.CurrentlyRunningMainloop:
# self.ParentForm.TKroot.quit()
_exit_mainloop(self.ParentForm) _exit_mainloop(self.ParentForm)
if self.DragSubmits:
if isinstance(self.ParentForm.LastButtonClicked, str): if isinstance(self.ParentForm.LastButtonClicked, str):
self.ParentForm.LastButtonClicked = self.ParentForm.LastButtonClicked + '+UP' self.ParentForm.LastButtonClicked = self.ParentForm.LastButtonClicked + '+UP'
else: else:
self.ParentForm.LastButtonClicked = (self.ParentForm.LastButtonClicked, '+UP') self.ParentForm.LastButtonClicked = (self.ParentForm.LastButtonClicked, '+UP')
# self.ParentForm.LastButtonClicked += '+UP' # this is the old method that required string key
self.MouseButtonDown = False self.MouseButtonDown = False
# button callback # button callback
def button_press_call_back(self, event): def button_press_call_back(self, event):
""" """