[SOLVED] Error message when image button hovered (hovered instead of hover)

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
Tojaw
Newbie
Posts: 6
Joined: Thu Jan 31, 2019 1:28 pm
Contact:

[SOLVED] Error message when image button hovered (hovered instead of hover)

#1 Post by Tojaw »

I want to display multiple character sprites as image buttons:

Code: Select all

for c in characters[1:]:
    if ImageReference(c + " Happy"):
        $img = ImageReference(c + " Happy")
    else:
        $img = ImageReference(c + " Normal")
    imagebutton:
        idle img
        hovered img #<------------------------------------------ mistake is here, use "hover" instead
        selected img
        action SetVariable("name",c)
However, when the button is hovered (and only then), an error message shows up.

That is surprising, considering that the hovered image and the idle image are the same. Does anyone have an idea?
Last edited by Tojaw on Tue Sep 08, 2020 5:22 pm, edited 2 times in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: "TypeError: 'ImageReference' object is not callable" when image button is hovered

#2 Post by Alex »

Tojaw wrote: Tue Sep 08, 2020 3:24 pm ... That is surprising, considering that the hovered image and the idle image are the same. Does anyone have an idea?
The thing is that 'hovered' is an action to run when button is hovered. Try 'hover' instead.
https://www.renpy.org/doc/html/screens.html#imagebutton

Tojaw
Newbie
Posts: 6
Joined: Thu Jan 31, 2019 1:28 pm
Contact:

Re: "TypeError: 'ImageReference' object is not callable" when image button is hovered

#3 Post by Tojaw »

Was it really that simple? It was. I actually want to delete that thread now now, because I am so embarrassed. I tried to find a solution for the past three days and was ready to give up. Sometimes I miss the most obvious things. Thank you. I will edit the original post to make it clearer. And I am sorry for not having checked that prior. I should have done that.

Post Reply

Who is online

Users browsing this forum: Nozori_Games