PySimpleGUI / PySimpleGUI/PySimpleGUI

[Bug] Grabbing a window by the Title bar and moving it around focuses without the <FocusIn> event

未關閉
#6,282 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

Bug Port - TK
主要語言
Python
星號
13.8k
分支
1.8k
PR 合併指標
30 天內沒有已合併 PR

描述

Type of Issue

Bug


Operating System

Windows 10

PySimpleGUI Port

tkinter


Versions

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

When dealing with multiple windows, i tracked the focused window using the and events. When clicking a window, these events get called normally. When grabbing a window by the Title bar and moving it around however, it is then focused without the events. Simply clicking on the Title Bar however focuses it with the events.

Code To Duplicate

A short program that isolates and demonstrates the problem


import PySimpleGUI as sg


#create two layouts
win1Layout = [
    [sg.Text('Win1')],
]
win2Layout = [
    [sg.Text('Win2')],
]

#size is important to make aenough room on the title bar to grab the windows
win1 = sg.Window('Win1', layout=win1Layout, size=(300, 100), finalize=True)
win2 = sg.Window('Win2', layout=win2Layout, size=(300, 100), finalize=True)

#bind the events to the windows
win1.bind('<FocusIn>', "WIN1FocusIn")
win1.bind('<FocusOut>', "WIN1FocusOut")
win2.bind('<FocusIn>', "WIN2FocusIn")
win2.bind('<FocusOut>', "WIN2FocusOut")


while True:
    activeWindow, event, values = sg.read_all_windows(timeout=500)

    if event == sg.WIN_CLOSED:
        break

    if not event == "__TIMEOUT__":
        print(event)

Screenshot, Sketch, or Drawing

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

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

首先在 Windows 10 上執行提供的最小重現,並檢查 tkinter 移植版對視窗焦點和事件繫結的處理。完成的標準是:透過標題列拖曳視窗時,能夠始終產生預期的 FocusIn 和 FocusOut 事件,同時保留一般標題列點擊的行為。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
desktop
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。