Page 1 of 1
[Solved]Hover one choice, dim other?
Posted: Sat Nov 20, 2021 6:40 am
by G0RG3h
Hello, how can I make it so that when you hover over one choice item, the other will darken? I'm not sure where to start on attempting it myself so I can't share any code of my own. Thank you!
Re: Hover one choice, dim other?
Posted: Sat Nov 20, 2021 12:48 pm
by zmook
It's easier to brighten the choice you're currently hovering, if that works for you. Make the default image the dimmer version, and do:
Code: Select all
imagebutton:
xysize 256,256
idle dimmer_img
hover brighter_img
action ShowMenu("lore_entry", entry)
Re: Hover one choice, dim other?
Posted: Sat Nov 20, 2021 3:26 pm
by G0RG3h
You're right, actually! Not sure why i thought that that qould be something to do when i could just do it manually. Thank you!
EDIT: Leaving this unsolved for anyone who would in the future like to show an actual way to do this. Thank you if you do, still!
Re: Hover one choice, dim other?
Posted: Sat Nov 20, 2021 4:56 pm
by drKlauz
Not sure if this is best way to do it, but why not
Code: Select all
init python:
class button_effect_fn(object):
def __init__(self,tt_id):
super(button_effect_fn,self).__init__()
self.tt_id=tt_id
def __call__(self,tf,st,at):
tt=GetTooltip()
if tt==self.tt_id:
tf.matrixcolor=BrightnessMatrix(0.0)
elif isinstance(tt,basestring) and tt.startswith("{#btn_"):
tf.matrixcolor=BrightnessMatrix(-0.25)
else:
tf.matrixcolor=None
return 0
transform tf_button_effect(tt_id):
function button_effect_fn(tt_id)
screen test():
vbox:
align (0.5,0.5)
for n in range(0,5):
$btn_id="{#btn_"+str(n)+"}"
textbutton "Button #[n]":
at tf_button_effect(btn_id)
tooltip btn_id
action NullAction()
label start:
show screen test
"test"
return
Idea is set tooltip to buttons along with transform, in this transform we call function which check which tooltip is currently set and darken concurrent buttons.
But usually idle/hover imagebutton states should be good looking enough.
Re: Hover one choice, dim other?
Posted: Sat Nov 20, 2021 7:52 pm
by G0RG3h
Thank you for the help! I just ended up making the buttons dim on default, enlarged the hover button and made it lighter, and made the font text bigger on hover and I got the illusion I wanted. Made it hard for myself for no reason,

Haha!
For any novices not sure how to change hover text size (like me), I just added this line in the choice button gui section. Easy as pie.
Code: Select all
define gui.choice_button_text_hover_size = 35