(Renpy) How can I align the choice buttons horizontally?

Jackboo1

Member
Aug 26, 2017
274
1,382
I want the choice buttons to be side by side horizontally.



The current code (I'm using the latest version of Renpy)

 

thecardinal

Latina midget, sub to my Onlyfans - cash for gash
Game Developer
Jul 28, 2017
1,491
4,422
vbox stands for 'vertical box' I would say find the instances of 'vbox' that you want to change and replace with 'hbox.' Without testing it myself, that should work
 

Jackboo1

Member
Aug 26, 2017
274
1,382
vbox stands for 'vertical box' I would say find the instances of 'vbox' that you want to change and replace with 'hbox.' Without testing it myself, that should work
Thank you so much... it's so simple... and it works perfect now!! I should read more Renpy documentation lol...

Thanks again!!! :biggrin:



 
  • Like
Reactions: thecardinal

thecardinal

Latina midget, sub to my Onlyfans - cash for gash
Game Developer
Jul 28, 2017
1,491
4,422
Glad I could help. Coding is really tough as hell, and the walls of text are super intimidating.
 
  • Like
Reactions: Jackboo1

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,113
14,770
The problem with this method is that you'll be more limited with your number of choice and/or their size. Another option is to have a switch for it.
Code:
screen choice(items):
    style_prefix "choice"

    if horizontalChoice is True:
        hbox:
            for i in items:
                textbutton i.caption action i.action
    else:
        vbox:
            for i in items:
                textbutton i.caption action i.action

default horizontalChoice = True
By default you'll have the horizontal display, but at anytime in your code you can fall back to the vertical one with :
Code:
    $ horizontalChoice = False
then return to the horizontal display with :
Code:
    $ horizontalChoice = True
It provide more flexibility, instead of forcing you to adapt to the more limited size, so it's a better option.
 

Jackboo1

Member
Aug 26, 2017
274
1,382
The problem with this method is that you'll be more limited with your number of choice and/or their size. Another option is to have a switch for it.
Code:
screen choice(items):
    style_prefix "choice"

    if horizontalChoice is True:
        hbox:
            for i in items:
                textbutton i.caption action i.action
    else:
        vbox:
            for i in items:
                textbutton i.caption action i.action

default horizontalChoice = True
By default you'll have the horizontal display, but at anytime in your code you can fall back to the vertical one with :
Code:
    $ horizontalChoice = False
then return to the horizontal display with :
Code:
    $ horizontalChoice = True
It provide more flexibility, instead of forcing you to adapt to the more limited size, so it's a better option.
This is more practical indeed... Thanks for this :)