[Bug] Infinite event loop (+MOVE) triggered by drag & drop on Ubuntu 22.04

Author: timminatorCreated Sep 5, 2026Updated Sep 5, 2026

Type of Issue (Enhancement, Error, Bug, Question)

Bug

Operating System

Ubuntu 22.04

PySimpleGUI Port (tkinter, Qt, Wx, Web)

tkinter


Versions

Python 3.12.8 PSG 6.3 TKinter 8.6.14


Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)

yes, pyside


Troubleshooting

These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

  • Searched main docs for your problem PySimpleGUI Documenation
  • Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demo Programs
  • None of your GUI code was generated by an AI algorithm like GPT
  • If not tkinter - looked for Demo Programs for specific port
  • For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
  • Run your program outside of your debugger (from a command line)
  • Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.com
  • Upgraded to the latest release of PySimpleGUI on PyPI (Version 6)

Detailed Description

Hi! I recently got aware of the newly added drag and drop support and wanted to add it to my program. It workls flawlessly under Windows, on Linux unfortunately I ran into an issue. As soon as I drop a video for example onto a canvas with drag_submits and motion_events set to true the GUI becomes inresponsive and freezes completely. Printing reveals that endless -MOVE- event are coming in. I was aplice to get it down to the following reproducer:

Code To Duplicate

python
import time
import PySimpleGUI as sg
import psgdnd as dnd

start_ref = time.monotonic()

def ts():
    return f"{(time.monotonic() - start_ref) * 1000:8.1f} ms"

layout = [
    [sg.Graph(
        canvas_size=(400, 300), 
        graph_bottom_left=(0, 300), 
        graph_top_right=(400, 0),
        key="-GRAPH-", 
        background_color="black",
        drag_submits=True,    # Trigger 1
        motion_events=True    # Trigger 2
    )]
]

window = sg.Window("Minimal Graph DnD Repro", layout, finalize=True)

# Register the Graph element for drag and drop
dnd.register_element_dnd(window["-GRAPH-"], window, dnd.DROP_TYPE_FILES)

print("Drag a file onto the black canvas. Watch the console for the event flood.")

while True:
    event, values = window.read()
    
    if event == sg.WIN_CLOSED:
        break
        
    print(f"[{ts()}] EVENT: {event!r}")
    
    if dnd.is_drop_event(event):
        print(f"[{ts()}] ---> File Dropped: {values[event]!r}")

window.close()

this results in the following endless console output:

bash
[ 17498.1 ms] EVENT: '-GRAPH-+MOVE'
[ 17498.3 ms] EVENT: '-GRAPH-+MOVE'
[ 17498.6 ms] EVENT: '-GRAPH-+MOVE'
[ 17498.8 ms] EVENT: '-GRAPH-+MOVE'
...

I could not reproduce it with tkinter and tkinterdnd2 alone - I also opened an issue over there (https://github.com/Eliav2/tkinterdnd2/issues/22), but after investigating I am pretty sure this is an PySimpleGUI issue.

Disclaimer: I also asked AI about this issue and let it try to debug this issue. It actually found a suspected culprit and also a suspected fix. The PySimpleGUI code is very dense for someone who has never taken a look at it before so I cant say it for certain but I tried it and it seems to resolve it - so I found it worth mentioning here.

This line seems to be the issue: https://github.com/PySimpleGUI/PySimpleGUI/blob/858d5d45babd66dc8ea7e20b797545b154e3f4dd/PySimpleGUI/PySimpleGUI.py#L7195

changing it to:

python
self.ParentForm.LastButtonClickedWasRealtime = self.DragSubmits and self.MouseButtonDown

resolves the issue with no further draw backs I was able to find but that is better to judge for you as the author :-)

Claude stated as his reasoning: Graph.motion_call_back sets LastButtonClickedWasRealtime = self.DragSubmits even when MouseButtonDown is False. When combined with psgdnd (or any write_event_value call from a DnD drop handler), the thread queue event can never be consumed because _BuildResults only reads the queue when LastButtonClicked is None.

I dont know if this is the actual fix, but I thought it was worth mentioning to you.

Watcha Makin?

GUI for extracting hardcoded subtitles out of Videos - https://github.com/timminator/VideOCR.