- Jun 21, 2020
- 67
- 86
Ok, so I actually have two main issues that I can't seem to get info about how to solve them.
I have a screen with two buttons (called left and right) that do stuff (doesn't really matter what they do), I want to achieve the same result of what they do, but using shift+left/shift+right AND shift+A/shift+D for left and right buttons respectively.
For now I managed to do this in separate lines, but:
I have a screen with two buttons (called left and right) that do stuff (doesn't really matter what they do), I want to achieve the same result of what they do, but using shift+left/shift+right AND shift+A/shift+D for left and right buttons respectively.
For now I managed to do this in separate lines, but:
- [SOLVED] Is there a way that I can have two keys for the same action in just the one line, instead of having duplicates? (it's not that important, but the tidier the code, the better for my ocd )
- [SOLVED] Another thing: is there a way that the actions of these key-presses replicate a buttons selected style? ...to be more specific, I want to make each button seem selected (highlight a little bit) when the mentioned keys are pressed respectively. So that, for example, the left/A keys highlight the left button on a key-press. Is there a way to achieve that or similar?
- [SOLVED] Edit: also I added two lines (one in each button) with a comment that says that they don't work for some reason, don't know why (they are supposed to do the same the hover_background does but on selection). Also, I know for sure that they don't work because I tried removing hover, and leaving selected and it still wouldn't highlight it on click.
Python:
screen room_selector():
key "shift_K_LEFT" action [SetVariable("location", move_to("left", location)), Return()]
key "shift_K_a" action [SetVariable("location", move_to("left", location)), Return()]
key "shift_K_RIGHT" action [SetVariable("location", move_to("right", location)), Return()]
key "shift_K_d" action [SetVariable("location", move_to("left", location)), Return()]
hbox:
xalign 0.5
yalign 0.0
xsize 192*2
ysize 54
frame:
yoffset 27
xfill True
style 'minimap_container'
button:
xsize 108
ysize 54
xpos 0
yalign 0.5
text "Left" size 13 xalign 0.5 yalign 0.5
background "#a43ac2"
hover_background lighten_color("#a43ac2", 0.2)
selected_background lighten_color("#a43ac2", 0.3) # this line does not work for some reason
action [SetVariable("location", move_to("left", location)), Return()]
button:
xsize 108
ysize 54
xalign 1.0
yalign 0.5
text "Right" size 13 xalign 0.5 yalign 0.5
background "#a43ac2"
hover_background lighten_color("#a43ac2", 0.2)
selected_background lighten_color("#a43ac2", 0.3) # this line does not work for some reason
action [SetVariable("location", move_to("right", location)), Return()]
Last edited: