Hover effect for a button:? [solved]

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
Eirrir
Regular
Posts: 81
Joined: Mon Feb 27, 2017 7:16 pm
Projects: Operation: Future Domination
Tumblr: Eirrir
itch: eirrir
Contact:

Hover effect for a button:? [solved]

#1 Post by Eirrir » Fri Jun 09, 2017 1:16 pm

Hi all,

I'm pretty sure this is a simple thing that I'm overlooking, but I'm trying to figure out how to have the background color of this button (which is part of a screen) be black when it's unhovered and red #b01107 when it's hovered:

Code: Select all

                for i in contact_list:
                    button:
                        xsize 300
                        background Solid("b01107")

                        text _(i.name) xalign 0.1 yalign 0.5
Any help would be greatly appreciated. Thank you!
Last edited by Eirrir on Fri Jun 09, 2017 2:31 pm, edited 1 time in total.
Current VN Project:
Image
Game Development Blog

mikolajspy
Regular
Posts: 169
Joined: Sun Jun 04, 2017 12:05 pm
Completed: Too many, check signature
Deviantart: mikolajspy
Location: Wrocław, Poland
Contact:

Re: Hover effect for a button:?

#2 Post by mikolajspy » Fri Jun 09, 2017 1:27 pm

Try this:https://www.renpy.org/doc/html/style_pr ... properties

I guess this code might work, but I didn't test it:

Code: Select all

for i in contact_list:
                    button:
                        xsize 300
                        idle_background Solid("#000000") #black when idle
                        hover_background Solid("b01107") #red when hovered

                        text _(i.name) xalign 0.1 yalign 0.5

User avatar
Eirrir
Regular
Posts: 81
Joined: Mon Feb 27, 2017 7:16 pm
Projects: Operation: Future Domination
Tumblr: Eirrir
itch: eirrir
Contact:

Re: Hover effect for a button:?

#3 Post by Eirrir » Fri Jun 09, 2017 2:30 pm

mikolajspy wrote:Try this:https://www.renpy.org/doc/html/style_pr ... properties

I guess this code might work, but I didn't test it:

Code: Select all

for i in contact_list:
                    button:
                        xsize 300
                        idle_background Solid("#000000") #black when idle
                        hover_background Solid("b01107") #red when hovered

                        text _(i.name) xalign 0.1 yalign 0.5
Thank you, it worked perfectly! This question has been solved :D
Current VN Project:
Image
Game Development Blog

Post Reply

Who is online

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