Tooltip not working

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
vitriolic_crux
Newbie
Posts: 23
Joined: Mon May 13, 2019 11:24 pm
Contact:

Tooltip not working

#1 Post by vitriolic_crux »

I'm trying to understand how the tooltip works, and why it seems so inconsistent. The tooltip is displayed when I hover over the textbuttons in the "Action Panel", but not anywhere else. The documentation states that tooltips can be used on any displayable, so why can I only get it to work with textbuttons? Thanks in advance.

Code: Select all

screen master_overlay():
        $ halls = Amerigo.getConnections()
        $ events = Horae.getEventList()
        $ week = Kronos.getWeek()
        $ day = Kronos.getDay()
        $ district = Amerigo.getDistrictName()
        $ clock = Kronos.getTime()
        $ location = Amerigo.getDisplayName()
        $ publicity = Amerigo.getPublicity()
        zorder 50
        modal False
        frame: # Information Display Panel, LHS
            background "hud_leftbar.png"
            xpadding 0
            ypadding 0
            xalign 0
            yalign 0
            xsize 120
            ysize 1080
            viewport:
                vbox:
                    # text "Week [week]" style "cybertext"
                    # text "Pub: [publicity]"style "cybertext"
                    textbutton "> Movement:" text_style "cybermenu"
                    spacing 0
                    for hall in halls:
                        python:
                            caption = ""
                            connection = hall[0]
                            caption = "Go to "+Amerigo.getDisplayName(name=connection)
                        textbutton caption :
                            text_style "cybertext"
                            #action [SetVariable("Amerigo.compass", hall[0]), Jump('overworld')]
                            action [Function(Amerigo.moveTo, fargo=hall[0]), Jump('overworld')]
        frame:
            background "hud_rightbar.png"
            xpadding 0
            ypadding 0
            xalign 0
            yalign 0
            xoffset 1800
            yoffset 0
            xsize 120
            ysize 1080

            fixed:
                tooltip "Oh gooood!"
                imagebutton:
                    xsize 120
                    ysize 120
                    xalign 0.5
                    ypadding 0
                    sensitive True
                    auto "panel_clock_button_%s.png"
                    tooltip "Oh gooood!"
                viewport:
                    text "[clock]" style "clock_hud" xalign 0.5 yoffset 8 # hud clock display
                    hbox: # Day-of-Week Display
                        xalign 0.5
                        spacing 2
                        yoffset 40
                        text "[day]" style "calendar_hud"
                        tooltip "Oh gooood!"


            fixed: # Current location display
                ysize 56
                yoffset 72
                hbox:
                    xalign 0.5
                    yalign 0.5
                    text "[location]" style "location_hud"

            viewport: # Action Panel, RHS Middle
                yoffset 140
                xoffset 5
                vbox:
                    spacing 0
                    #textbutton "> Actions:" text_style "cybermenu"
                    for int in events:
                        python:
                            caption = ""
                            caption = int['dname']
                        textbutton caption :
                            text_style "interaction_text"
                            action Jump(int['name'])
                            tooltip "Action menu"

                $tooltip = GetTooltip()

                if tooltip:
                    frame:
                        xalign 0.5
                        yalign 0.5
                        text "[tooltip]" style "clock_hud"

            fixed:
                xsize 100
                ysize 50
                xalign 0.5
                yoffset 774
                imagebutton:
                    auto "panel_system_button_%s.png"
                    xalign 0.5
                    tooltip "show_calendar"
                text "Inventory" style "interaction_text" xalign 0.5 yoffset 13

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3811
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Tooltip not working

#2 Post by Imperf3kt »

I see you've put tooltips in places like a hbox.
A hbox or vbox or fixed etc are not displayable, they're containers.
If you want to use tool tips this way, place a button inside your container and place your text and other things inside that.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Tooltip not working

#3 Post by philat »

The documentation is somewhat misleading -- only displayables that can take focus can actually have tooltips (as the tooltip is only updated when the displayable takes focus).

vitriolic_crux
Newbie
Posts: 23
Joined: Mon May 13, 2019 11:24 pm
Contact:

Re: Tooltip not working

#4 Post by vitriolic_crux »

Thanks, guys. You didn't give me the answer, but you certainly got me started. The big problem that I was focused on was why the imagebuttons weren't displaying their tooltips. Then philat said
only displayables that can take focus can actually have tooltips
I realized then that my imagebuttons weren't taking focus, so I had to figure out why that was. Turns out I just needed to give them a dummy action to make them start listening for an input. In my case, that was action NullAction().

Post Reply

Who is online

Users browsing this forum: Google [Bot]