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 » Mon Mar 05, 2018 11:41 am

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?

User avatar
Andredron
Miko-Class Veteran
Posts: 535
Joined: Thu Dec 28, 2017 2:37 pm
Completed: Kimi ga nozomu renpy-port(demo), Albatross Koukairoku(demo)
Projects: Sisters ~Natsu no Saigo no Hi~(renpy-port)
Location: Russia
Contact:

Re: New tooltip class and imagebuttons

#2 Post by Andredron » Mon Mar 05, 2018 2:19 pm

I'm writing a Renpy textbook (in Russian). https://disk.yandex.ru/i/httNEajU7iFWHA (all information is out of date) Update 22.06.18

Help me to register in QQ International

Honest Critique

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

Re: New tooltip class and imagebuttons

#3 Post by ReDZiX » Mon Mar 05, 2018 2:32 pm

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: 3636
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: New tooltip class and imagebuttons

#4 Post by Imperf3kt » Mon Mar 05, 2018 4:56 pm

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
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

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 » Tue Mar 06, 2018 5:24 am

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 » Tue Mar 06, 2018 5:33 am

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 » Tue Mar 06, 2018 9:36 am

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: 752
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 » Tue Mar 06, 2018 11:06 pm

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: No registered users