New tooltip class and imagebuttons

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
User avatar
Bruni Multimedia
Regular
Posts: 114
Joined: Mon May 15, 2017 12:23 pm
Projects: Yomi Alliance
Organization: Bruni Multimedia
itch: brunimultimedia
Contact:

New tooltip class and imagebuttons

#1 Post by Bruni Multimedia »

Ren'Py documentation has an example of the new Tooltip class recently introduced with a textbutton.

I tried to do the same with imagebuttons but it doesn't work (nor does it give any error).

Does the new class work with imagebuttons?


ReDZiX
Regular
Posts: 32
Joined: Thu Jan 04, 2018 12:42 pm
Contact:

Re: New tooltip class and imagebuttons

#3 Post by ReDZiX »

Working fine for me, maybe a bug in most recent release? I'm still using stable 6.99.14.1.

Code: Select all

screen tooltip_test():
    
    frame:
        xalign .5 yalign .5
        has vbox

        imagebutton auto "gui/tbutton_%s.png":
            action Return()
            tooltip "Testing imagebutton."

        textbutton "Test":  
            action Return()
            tooltip "Testing textbutton"

    $ tt = GetTooltip() #I've noticed this variable can't be declared with default, is this intended?

    if tt:
        text "[tt]"

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

Re: New tooltip class and imagebuttons

#4 Post by Imperf3kt »

You can still use the old tooltip way. I prefer it myself, its easier to understand.
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

User avatar
Bruni Multimedia
Regular
Posts: 114
Joined: Mon May 15, 2017 12:23 pm
Projects: Yomi Alliance
Organization: Bruni Multimedia
itch: brunimultimedia
Contact:

Re: New tooltip class and imagebuttons

#5 Post by Bruni Multimedia »

Imperf3kt wrote: Mon Mar 05, 2018 4:56 pm You can still use the old tooltip way. I prefer it myself, its easier to understand.
You're right, but I was trying to simplify the coding and the new way looks like much smoother... I'll try the solution above and see if it works...

User avatar
Bruni Multimedia
Regular
Posts: 114
Joined: Mon May 15, 2017 12:23 pm
Projects: Yomi Alliance
Organization: Bruni Multimedia
itch: brunimultimedia
Contact:

Re: New tooltip class and imagebuttons

#6 Post by Bruni Multimedia »

Ok, it seems to work.
ReDZiX wrote: Mon Mar 05, 2018 2:32 pm $ tt = GetTooltip() #I've noticed this variable can't be declared with default, is this intended?
According to changelog we should be able to default it though:

https://www.renpy.org/doc/html/changelog.html

Code: Select all

default tt = Tooltip("No button selected.")

textbutton "One.":
    action Return(1)
    hovered tt.Action("The loneliest number.")

text tt.value
Last edited by Bruni Multimedia on Tue Mar 06, 2018 5:35 am, edited 1 time in total.

ReDZiX
Regular
Posts: 32
Joined: Thu Jan 04, 2018 12:42 pm
Contact:

Re: New tooltip class and imagebuttons

#7 Post by ReDZiX »

According to changelog we should be able to default it though
I see now, I was trying to default it inside the screen, as a screen variable, my bad. Thanks!

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: New tooltip class and imagebuttons

#8 Post by Milkymalk »

One advantage the old tooltip way has is that you can have different elements activate different tooltips, or even have one element activate several tooltips at once. With the new way, you have to crunch all tooltips into one comprehensive string and then parse it.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Post Reply

Who is online

Users browsing this forum: 3N16M4, Bing [Bot], Google [Bot]