Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
5 of 8 tasks
April-2-1 opened this issue Mar 7, 2023 · 2 comments
Labels
Bug Something's not right Port - TK PySimpleGUI

Comments

@April-2-1
Copy link

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

@jason990420
Copy link
Collaborator

It looks it is caused by the argument timeout.

Following action can make '<FocusIn>' work better or work fine.

  • Remove argument timeout, or
  • Set values of timeout to higher, like timeout=1000.

This issue maybe something related to issue #5495

@jason990420 jason990420 added Bug Something's not right Port - TK PySimpleGUI labels Mar 8, 2023
@PySimpleGUI
Copy link
Owner

PySimpleGUI commented Apr 2, 2023

Is this related to the same focus / entry problem that started in 8.6.12 that we noticed with tooltips?

EDIT - AH! RIGHT! I remember @nachocho also reporting problems similar. I'm wondering if these are 8.6.12 specific and if 8.6.13 may fix them. I believe 8.6.13 may have fixed or improved the disappearing window problem on the Mac, but have not had enough time to verify it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something's not right Port - TK PySimpleGUI
Projects
None yet
Development

No branches or pull requests

3 participants