How to change spacing of main menu buttons?

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
rusicaria
Regular
Posts: 84
Joined: Sat Mar 28, 2020 12:26 am
Projects: VivaCity (VN)
Tumblr: rusicariaGAMES
itch: rusicariaGAMES
Contact:

How to change spacing of main menu buttons?

#1 Post by rusicaria »

Hi guys, so I've changed the layout of the main menu buttons so that it's horizontal. Is there a way to change the position of each button individually, and if not, a way to even out the spacing between each button? Bare in mind I've tried using 'spacing' but nothing is really changing.

Thank you :)

User avatar
qirien
Miko-Class Veteran
Posts: 541
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
itch: qirien
Location: New Mexico, USA
Discord: qirien
Contact:

Re: How to change spacing of main menu buttons?

#2 Post by qirien »

You can set them to exact locations with xpos and ypos . . . is that what you're thinking of?
https://www.renpy.org/doc/html/style_pr ... properties
For example:

Code: Select all

textbutton _("Load") action ShowMenu("load") xpos 200 ypos 100
Finished games:
Image
Image
Image

User avatar
rusicaria
Regular
Posts: 84
Joined: Sat Mar 28, 2020 12:26 am
Projects: VivaCity (VN)
Tumblr: rusicariaGAMES
itch: rusicariaGAMES
Contact:

Re: How to change spacing of main menu buttons?

#3 Post by rusicaria »

qirien wrote: Tue May 12, 2020 6:14 pm You can set them to exact locations with xpos and ypos . . . is that what you're thinking of?
https://www.renpy.org/doc/html/style_pr ... properties
For example:

Code: Select all

textbutton _("Load") action ShowMenu("load") xpos 200 ypos 100
Yes and no. I understand how to change the location but still whenever I tried to change the exact location of each button the spacing between the different buttons still automatically moved with the rest. It's not an issue anymore because I changed the layout, but if anyone still knew how to change this then I'd still like to know :?

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: How to change spacing of main menu buttons?

#4 Post by hell_oh_world »

If you contained your buttons inside an hbox it should align themselves horizontally with even spaces... you can then set the spacing of each by setting it through the spacing property...

Code: Select all

screen navigation():
    hbox:
        spacing 10 # gives a 10 pixel-wide space between each button

        textbutton "button 1" action NullAction() 
        textbutton "button 2" action NullAction() 
        textbutton "button 3" action NullAction() 
also, if you didn't tamper with the navigation's screen alignment very well, you can find a variable in the navigation screen called `gui.navigation_spacing`. you can then set that globally to whatever you want to automatically adjust the spaces without going to the navigation screen and setting it by yourself.
https://www.renpy.org/doc/html/gui.html ... navigation

Code: Select all

define gui.navigation_spacing = 10

# the default screen below...
screen navigation():

    vbox:
        style_prefix "navigation"

        xpos gui.navigation_xpos
        yalign 0.5

        spacing gui.navigation_spacing

        if main_menu:

            textbutton _("Start") action Start()

            textbutton _("Prologue") action Start("prologue")
        # other codes.... (truncated)

Post Reply

Who is online

Users browsing this forum: Donmai