PySimpleGUI / PySimpleGUI/PySimpleGUI

[Possible Bug] Tooltip behaves funny when using timeout

Open
#2,118 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13.8k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

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

If I use for example window.Read(timeout=500) and want to use set_tooltip in the main loop, the tooltip stays permanently:
tooltip_screenshot

I have also tried this proposed solution: https://github.com/PySimpleGUI/PySimpleGUI/issues/1402

I intend to check a status every few seconds and display the result in the tooltip.
If there is no workaround for this particular phenomenon, does anyone have any idea how to trigger/call a function if the window was inactive in background and becomes active again? I would really appreciate a solution or tip...

Operating System

Windows 10

Python version

3.7.5

PySimpleGUI Port and Version

PySimpleGUI TK 4.5.0.26

Your Experience Levels In Months or Years

8 MONTHS - Python programming experience
2 YEARS (JavaScript / PHP) - Programming experience overall
NO - Have used another Python GUI Framework (tkiner, Qt, etc) previously (yes/no is fine)?

You have completed these steps:
  • Read instructions on how to file an Issue
  • Searched through main docs http://www.PySimpleGUI.org for your problem
  • Searched through the readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
  • Looked for Demo Programs that are similar to your goal http://www.PySimpleGUI.com
  • Note that there are also Demo Programs under each port on GitHub
  • Run your program outside of your debugger (from a command line)
  • Searched through Issues (open and closed) to see if already reported
Code or partial code causing the problem
import PySimpleGUI as sg
import random

layout = [[sg.Text('This is a sample text.', key='_text_', tooltip='')],
          [sg.Button('Exit')]]

window = sg.Window('Window Title', layout, finalize=True)

while True:
    event, values = window.Read(timeout=500)

    if event in (None, 'Exit'):
        break

    window['_text_'].set_tooltip(random.randint(500, 1000))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal reproduction using Window.Read(timeout=500) and repeated set_tooltip calls on the text element. Trace the PySimpleGUI TK tooltip behavior around those entry points, then verify whether the tooltip updates and expires as expected when the window is active and when it regains focus.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.