tooltips don't work

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
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

tooltips don't work

#1 Post by Imperf3kt »

So I'm trying to force myself to use the newer tooltip function instead of the deprecated legacy tooltip function (which works perfectly)

I'm running into issues though...

Here is my screen:

Code: Select all

screen audio_settings():
    tag menu
    use game_menu(_("Audio"), scroll="viewport"):
        style_prefix "audio_settings"
        
        $tooltip = GetToolTip()
        
        vbox:
            xalign 0.5
            if tooltip:
                text "[tooltip]"
            
        vbox:
            
            if config.has_music:
                label _("Music Volume")

                hbox:
                    bar value Preference("music volume")

            if config.has_sound:

                label _("Sound Volume")

                hbox:
                    bar value Preference("sound volume")

                    if config.sample_sound:
                        textbutton _("Test") action Play("sound", config.sample_sound)


            if config.has_voice:
                label _("Voice Volume")

                hbox:
                    bar value Preference("voice volume")

                    if config.sample_voice:
                        textbutton _("Test") action Play("voice", config.sample_voice)

            if config.has_music or config.has_sound or config.has_voice:
                null height gui.pref_spacing

                textbutton _("Mute All"):
                    action Preference("all mute", "toggle")
                    style "mute_all_button"
                    
If I use the example in the documentation (the above), I get an error when trying to access the screen using tooltip:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/rps.rpy", line 105, in execute
    screen audio_settings():
  File "game/rps.rpy", line 105, in execute
    screen audio_settings():
  File "game/rps.rpy", line 107, in execute
    use game_menu(_("Audio"), scroll="viewport"):
  File "game/screens.rpy", line 451, in execute
    screen game_menu(title, scroll=None, yinitial=0.0):
  File "game/screens.rpy", line 451, in execute
    screen game_menu(title, scroll=None, yinitial=0.0):
  File "game/screens.rpy", line 457, in execute
    frame:
  File "game/screens.rpy", line 460, in execute
    hbox:
  File "game/screens.rpy", line 462, in execute
    frame:
  File "game/screens.rpy", line 465, in execute
    if scroll == "viewport":
  File "game/screens.rpy", line 467, in execute
    viewport:
  File "game/screens.rpy", line 476, in execute
    vbox:
  File "game/screens.rpy", line 477, in execute
    transclude
  File "game/rps.rpy", line 107, in execute
    use game_menu(_("Audio"), scroll="viewport"):
  File "game/rps.rpy", line 110, in execute
    $tooltip = GetToolTip()
  File "game/rps.rpy", line 110, in <module>
    $tooltip = GetToolTip()
NameError: name 'GetToolTip' is not defined

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in script
    python hide:
  File "C:\Program Files (x86)\renpy\renpy\ast.py", line 882, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Program Files (x86)\renpy\renpy\python.py", line 1913, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in <module>
    python hide:
  File "renpy/common/_layout/screen_main_menu.rpym", line 35, in _execute_python_hide
    ui.interact()
  File "C:\Program Files (x86)\renpy\renpy\ui.py", line 289, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Program Files (x86)\renpy\renpy\display\core.py", line 2662, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "C:\Program Files (x86)\renpy\renpy\display\core.py", line 3049, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Program Files (x86)\renpy\renpy\display\core.py", line 521, in visit_all
    d.visit_all(callback, seen)
  File "C:\Program Files (x86)\renpy\renpy\display\core.py", line 521, in visit_all
    d.visit_all(callback, seen)
  File "C:\Program Files (x86)\renpy\renpy\display\core.py", line 521, in visit_all
    d.visit_all(callback, seen)
  File "C:\Program Files (x86)\renpy\renpy\display\core.py", line 521, in visit_all
    d.visit_all(callback, seen)
  File "C:\Program Files (x86)\renpy\renpy\display\screen.py", line 424, in visit_all
    callback(self)
  File "C:\Program Files (x86)\renpy\renpy\display\core.py", line 3049, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Program Files (x86)\renpy\renpy\display\screen.py", line 434, in per_interact
    self.update()
  File "C:\Program Files (x86)\renpy\renpy\display\screen.py", line 619, in update
    self.screen.function(**self.scope)
  File "game/rps.rpy", line 105, in execute
    screen audio_settings():
  File "game/rps.rpy", line 105, in execute
    screen audio_settings():
  File "game/rps.rpy", line 107, in execute
    use game_menu(_("Audio"), scroll="viewport"):
  File "game/screens.rpy", line 451, in execute
    screen game_menu(title, scroll=None, yinitial=0.0):
  File "game/screens.rpy", line 451, in execute
    screen game_menu(title, scroll=None, yinitial=0.0):
  File "game/screens.rpy", line 457, in execute
    frame:
  File "game/screens.rpy", line 460, in execute
    hbox:
  File "game/screens.rpy", line 462, in execute
    frame:
  File "game/screens.rpy", line 465, in execute
    if scroll == "viewport":
  File "game/screens.rpy", line 467, in execute
    viewport:
  File "game/screens.rpy", line 476, in execute
    vbox:
  File "game/screens.rpy", line 477, in execute
    transclude
  File "game/rps.rpy", line 107, in execute
    use game_menu(_("Audio"), scroll="viewport"):
  File "game/rps.rpy", line 110, in execute
    $tooltip = GetToolTip()
  File "game/rps.rpy", line 110, in <module>
    $tooltip = GetToolTip()
NameError: name 'GetToolTip' is not defined

Windows-8-6.2.9200
Ren'Py 7.1.1.929
RPSv2 0.3.02
Fri Nov 16 05:26:16 2018
So I thought to take GetToolTip() out of the screen and default it:

Code: Select all

default tooltip = GetToolTip()
This causes the game to crash during initialisation with the following...

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "renpy/common/00start.rpy", line 185, in script
    python:
  File "renpy/common/00start.rpy", line 186, in <module>
    renpy.execute_default_statement(True)
  File "game/rps.rpy", line 4, in set_default
    default tooltip = GetToolTip()
  File "game/rps.rpy", line 4, in <module>
    default tooltip = GetToolTip()
NameError: name 'GetToolTip' is not defined

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "C:\Program Files (x86)\renpy\renpy\bootstrap.py", line 313, in bootstrap
    renpy.main.main()
  File "C:\Program Files (x86)\renpy\renpy\main.py", line 513, in main
    run(restart)
  File "C:\Program Files (x86)\renpy\renpy\main.py", line 139, in run
    renpy.execution.run_context(True)
  File "C:\Program Files (x86)\renpy\renpy\execution.py", line 876, in run_context
    context.run()
  File "renpy/common/00start.rpy", line 185, in script
    python:
  File "C:\Program Files (x86)\renpy\renpy\ast.py", line 882, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Program Files (x86)\renpy\renpy\python.py", line 1913, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/00start.rpy", line 186, in <module>
    renpy.execute_default_statement(True)
  File "C:\Program Files (x86)\renpy\renpy\exports.py", line 3303, in execute_default_statement
    i.set_default(start)
  File "game/rps.rpy", line 4, in set_default
    default tooltip = GetToolTip()
  File "C:\Program Files (x86)\renpy\renpy\python.py", line 1937, in py_eval_bytecode
    return eval(bytecode, globals, locals)
  File "game/rps.rpy", line 4, in <module>
    default tooltip = GetToolTip()
NameError: name 'GetToolTip' is not defined

Windows-8-6.2.9200
Ren'Py 7.1.1.929
RPSv2 0.3.02
Fri Nov 16 05:29:00 2018

Anybody know anything?
I'm just going to use the legacy tooltip for now, but I'd really like to "update" to the (seemingly) better new way of doing it.
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

morganw
Regular
Posts: 51
Joined: Fri Nov 20, 2015 7:00 pm
Contact:

Re: tooltips don't work

#2 Post by morganw »

I think this is just a typo.

This doesn't exist:

Code: Select all

$ tooltip = GetToolTip()
This is fine:

Code: Select all

$ tooltip = GetTooltip()
Last edited by morganw on Thu Nov 15, 2018 5:43 pm, edited 1 time in total.

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

Re: tooltips don't work

#3 Post by Imperf3kt »

morganw wrote: Thu Nov 15, 2018 3:35 pm I think this is just a typo.

This doesn't exit:

Code: Select all

$ tooltip = GetToolTip()
This is fine:

Code: Select all

$ tooltip = GetTooltip()
Ah, so it looks. (can't check now as I'm at work now)

This is why I shouldn't do stuff in Ren'Py at 5am...


Thankyou for helping point it out.
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

Post Reply

Who is online

Users browsing this forum: Google [Bot]