Button Text Hover Color

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
mysterique
Newbie
Posts: 4
Joined: Wed Aug 20, 2014 7:27 am
Contact:

Button Text Hover Color

#1 Post by mysterique »

Hi, this is probably a really basic question, but I've been wanting to change the button text colour when someone hovers the mouse over it, but haven't been able to work out how.
I can change the button colour, but not the text colour.

Essentially, I want to remove the 'button' all together and just have the text there. When someone puts their mouse on it, the colour should change.

Thanks you!

User avatar
fluxus
Regular
Posts: 133
Joined: Thu Jun 19, 2014 8:06 am
Projects: Animal Anaesthesia (a teaching game)
Contact:

Re: Button Text Hover Color

#2 Post by fluxus »

Couldn't you change text_style with the actions run on hovered/unhovered?
(assuming the use of textbutton)

mysterique
Newbie
Posts: 4
Joined: Wed Aug 20, 2014 7:27 am
Contact:

Re: Button Text Hover Color

#3 Post by mysterique »

I've tried that, but was unsuccessful. I'm not too good with coding, so I really don't know what I'm doing.
Is there anyway of achieving this with the regular button?

Thanks!

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Button Text Hover Color

#4 Post by xela »

As fluxus said, you should simply use styles. set background to Null() if you just want the text and use hover/idle prefixes to specify colors.
Like what we're doing? Support us at:
Image

mysterique
Newbie
Posts: 4
Joined: Wed Aug 20, 2014 7:27 am
Contact:

Re: Button Text Hover Color

#5 Post by mysterique »

Okay, I'll try doing that again.
Would it be possible for someone to post a code snippet example please?
As I said, I'm not great with coding and I'm even less experienced with python (I have done a little VB)), so im really just working by trial and error at the moment.

User avatar
saguaro
Miko-Class Veteran
Posts: 560
Joined: Sun Feb 12, 2012 9:17 am
Completed: Locked-In, Sunrise, The Censor
Organization: Lucky Special Games
itch: saguarofoo
Location: USA
Contact:

Re: Button Text Hover Color

#6 Post by saguaro »

Code: Select all

label start:
    show screen test
    pause
    return
    
screen test:    
    vbox:
        style_group "test"    
        textbutton "Hover Me" action NullAction()
       
style test_button:
    background None

style test_button_text:
    color "#FFF"
    hover_color "#000"   

mysterique
Newbie
Posts: 4
Joined: Wed Aug 20, 2014 7:27 am
Contact:

Re: Button Text Hover Color

#7 Post by mysterique »

Thanks so much!

Post Reply

Who is online

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