[Bug] Grabbing a window by the Title bar causes the window.read to block until the window is released
还没有人认领这个 Issue。
评估
调研方向
未指定源文件或测试。首先运行提供的 Windows 11/Python 3.10.6 tkinter 重现程序,并比较拖动标题栏与 CTRL+left-click。完成的标准是确定在正常拖动标题栏期间 window.read(timeout=500) 是否可以继续返回,并记录或修正该行为。
由索引模型根据 Issue 内容生成。
描述
Type of Issue: Bug
Operating System
Windows 11
PySimpleGUI Port (tkinter, Qt, Wx, Web)
Versions
Version information can be obtained by calling sg.main_get_debug_data()
Or you can print each version shown in ()
Python version
Python 3.10.6
PySimpleGUI Version
PySimpleGUI 4.60.4
GUI Version
tkinter 8.6.12
Your Experience In Months or Years (optional)
4 Years Python programming experience
5 Years Programming experience overall
Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)
No, i have not
Anything else you think would be helpful?
Troubleshooting
These items may solve your problem. Please check those you've done by changing - [ ] to - [X]
- Searched main docs for your problem www.PySimpleGUI.org
- Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demos.PySimpleGUI.org
- 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.org
- Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
- Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released
Detailed Description
I recently ran i some problems with too long runtimes in the main event loop, causing problems if windows are closed and the program is currently somewhere between detecting closed windows and interacting with the (now closed) window.
To track the time each loop takes i simply printed the runtime to the console.
While doing so, i noticed that, despite setting a timeout on window.read, the event looped halted when i was moving the window. I looked a bit into it and apparently the window.read() blocks when the title bar is clicked. as soon as i release the mouse button, it continues.
This error does not occur when moving the window with CTRL-MOUSE_LEFT.
Code To Duplicate
A short program that isolates and demonstrates the problem
import PySimpleGUI as sg
#used to measure event loop time
import datetime
#just to have something in the layout
layout = [[sg.Text("Lorem ipsum")]]#just to have something in the layout
#create the window. size is important as we need space to grab it by the titlebar
window = sg.Window("Timing test window", layout, size=(300, 100), finalize=True)
#set the timeout value
TIMEOUT = 500
#initialize the variable
startTime = datetime.datetime.now()
while True:
#calculate the time of one event loop, output is in milliseconds
runTime = round((datetime.datetime.now() - startTime).total_seconds()*1000 - TIMEOUT, 1)
#output the last event loops time
print(runTime, "ms")
#set the new startTime
startTime = datetime.datetime.now()
#run the event loop
event, values = window.read(timeout=TIMEOUT)
if event == sg.WIN_CLOSED:
exit("Window closed")
Watcha Makin?
Im a Student working in a company between semesters and have been tasked with creating a program to write certain Tables to the EEPROM of the devices we are selling
- 主要语言
- Python
- 星标
- 13.8k
- 派生
- 1.8k
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PySimpleGUI/PySimpleGUI 的其他 Issue
-
Bug Done - Install Dev Build (see docs for how) Platform Specific Issue - Linux Port - TK
难度 2/5 1-3 小时 新手友好度 68/100
PySimpleGUI/PySimpleGUI#6904 · 15 条评论 ·
-
Bug Demo Programs Done - Install Dev Build (see docs for how) Interoperability Port - TK workaround available
难度 2/5 1-3 小时 新手友好度 68/100
PySimpleGUI/PySimpleGUI#6900 · 1 条评论 ·
-
Done - Install Dev Build (see docs for how) enhancement
难度 2/5 1-3 小时 新手友好度 62/100
PySimpleGUI/PySimpleGUI#3251 · 12 条评论 ·
-
难度 3/5 1-2 天 新手友好度 74/100
PySimpleGUI/PySimpleGUI#6906 · 1 条评论 · 1 个 reaction ·
-
Bug Done - Install Dev Build (see docs for how) Port - TK
难度 3/5 1-2 天 新手友好度 45/100
PySimpleGUI/PySimpleGUI#6902 · 1 条评论 ·
查看 PySimpleGUI/PySimpleGUI 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/skills#1811 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
speaches-ai/speaches#678 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
datalayer/mcp-compose#42 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
conda-forge/spacy-feedstock#177 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
UKGovernmentBEIS/inspect_evals#2523 ·