Skip to content

Tooltips don't work on buttons with absolute position #2651

@ndahn

Description

@ndahn

Dear PyGui version:

2.3

Python version:

3.13.11

Operating system:

Windows 11

My issue/question:

Tooltips don't work when added to buttons or image_buttons with pos set. Other widgets work (at least the few I tested). As a workaround the position can be set on group holding both.

Steps to reproduce:

dpg.add_button(label="pos on button", pos=(20, 20))
with dpg.tooltip(dpg.last_item()):
    dpg.add_text("HELLO")

Expected behavior:

Tooltip on hover. Workaround is to embed the button and tooltip in a group and set the position on the group instead.

Screenshots:

N/A

Standalone, minimal, complete and verifiable example:

import dearpygui.dearpygui as dpg

dpg.create_context()
dpg.create_viewport(title="Custom Title", width=600, height=600)

with dpg.window():
    dpg.add_button(label="pos on button", pos=(20, 20))
    with dpg.tooltip(dpg.last_item()):
        dpg.add_text("HELLO")

    with dpg.group(pos=(20, 60)):
        dpg.add_button(label="pos on group")
        with dpg.tooltip(dpg.last_item()):
            dpg.add_text("HELLO")

dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions