PySimpleGUI / PySimpleGUI/PySimpleGUI
[Enhancement] PySimpleGUI-TK Ability to force window focus
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.8k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
When running multiple windows, serially where one is closed before another open, on Windows,
new windows do not receive focus after the first window. Only the initial window is given focus after creation.
Where is a workaround available. Use this when you create your window:
window.TKroot.focus_force() # Force this window to have focus
window.Element('-FIRST-INPUT-FIELD-KEY').SetFocus() # Force this Element to have focus
This will focus the window and move the cursor to the indicated Element.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Windows behavior with serially created PySimpleGUI-TK windows, then read the existing focus entry points named in the issue: window.TKroot.focus_force() and Element('-FIRST-INPUT-FIELD-KEY').SetFocus(). Done means newly created windows receive focus consistently without requiring this workaround, while the indicated element can still receive cursor focus.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100