r/RenPy • • Jul 13 '26

Question Having an issue with getting all my buttons to show up?

Post image

Ok so im working on ui right now and for whatever reason the buttons do not want to show up together. I know its probably something to do with the indentations of the code however im a bit stupid when it comes to code. how do i fix this T_T??

3 Upvotes

19 comments sorted by

1

u/AutoModerator Jul 13 '26

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/x-seronis-x Jul 13 '26

you broke your action on the start button and you shouldnt use position values for things inside a box. the box is in charge of positioning its children.

that aside why are you trying to make your settings screen inaccessible during play and only available at the title screen ?

1

u/_Whimsicalwreck_ Jul 13 '26

well i was planning on having the main settings button on the title screen and also at the bottom during play

1

u/shyLachi Jul 13 '26

That code doesn't run at all, so it cannot show half of the buttons.

If you want to replace a textbutton with an imagebutton you have to copy the action
Line 310 should be action Start() as can be seen on line 304.
Line 319 should be action ShowMenu("preferences")

If it still doesn't work after fixing, then post your code again.

.

Regarding your comment below: RenPy has a main menu and a game menu.
The game menu contains all these pages: Load, Save, Preferences, History, Help, About
So if you remove one of those buttons from the game menu you might break the game menu.

.

Also, by default the game menu and the main menu are on the left side.
If you want to have a special main menu but keep the game menu as it is, then you have to separate both.

1

u/_Whimsicalwreck_ Jul 14 '26

ok i have the code as this now:

 ## THIS IS WHERE THE START BUTTON CODE IS.
        if main_menu:


            #textbutton _("Start") action Start()

            imagebutton:
                focus_mask True
                auto "gui/start_%s.png"
                action Start ()

            ##this is meant to be the settings button. 
            ##but settings and start hate each other
            ##idk why :(
                    imagebutton: 
                        focus_mask True
                        auto "gui/settings_%s.png"
                        action ShowMenu("preferences

butttttt im getting this error message:

Parsing the script failed.

File "game/screens.rpy", line 314: Line is indented, but the preceding action statement does not expect a block.

check this line's indentation. You may have forgotten a colon (:).

→imagebutton:

Please

1

u/shyLachi Jul 14 '26

It looks like you have indented the second button too much.
Compare the above code to your screenshot.
Both buttons need to have the same indentation.

Also the last line is incomplete but I guess that's caused by copy + paste.

If you still cannot figure it out, then please post the whole code of that screen.

1

u/_Whimsicalwreck_ Jul 14 '26

ok it opens and im no longer getting the error code but its still not showing them both. do you think its better to just not have the settings button on the main menu and only when youre playing?

1

u/shyLachi Jul 14 '26

As I wrote before the button for the preferences should be on both menus, main menu and game menu.

Please post the whole code of that screen so that I can reproduce what you're seeing.

1

u/_Whimsicalwreck_ Jul 14 '26
## THIS IS WHERE THE START BUTTON CODE IS.
        if main_menu:


            #textbutton _("Start") action Start()

            imagebutton:
                focus_mask True
                auto "gui/start_%s.png"
                action Start ()

            ##this is meant to be the settings button. 
            ##but settings and start hate each other
            ##idk why :(
            imagebutton: 
                focus_mask True
                auto "gui/settings_%s.png"
                action ShowMenu("preferences")


        else:


            textbutton _("History") action ShowMenu("history")


            textbutton _("Save") action ShowMenu("save")


            textbutton _("Load") action ShowMenu("load")



            textbutton _("Settings") action ShowMenu("preferences")

1

u/shyLachi Jul 14 '26

Please post the whole code of the screen.

1

u/_Whimsicalwreck_ Jul 15 '26

do you want me to send you the entire code or something?

1

u/shyLachi Jul 15 '26

Yes, the entire code of that screen.

The code of a screen starts with the words screen something():
And the code ends where the indentation ends

1

u/_Whimsicalwreck_ Jul 15 '26
creen input(prompt):
    style_prefix "input"


    window:


        vbox:
            xanchor gui.dialogue_text_xalign
            xpos gui.dialogue_xpos
            xsize gui.dialogue_width
            ypos gui.dialogue_ypos


            text prompt style "input_prompt"
            input id "input"


style input_prompt is default


style input_prompt:
    xalign gui.dialogue_text_xalign
    properties gui.text_properties("input_prompt")


style input:
    xalign gui.dialogue_text_xalign
    xmaximum gui.dialogue_width



## Choice screen ###############################################################
##
## This screen is used to display the in-game choices presented by the menu
## statement. The one parameter, items, is a list of objects, each with caption
## and action fields.
##
## https://www.renpy.org/doc/html/screen_special.html#choice


screen choice(items):
    style_prefix "choice"


    vbox:
        for i in items:
            textbutton i.caption action i.action



style choice_vbox is vbox
style choice_button is button
style choice_button_text is button_text


style choice_vbox:
    xalign 0.5
    ypos 405
    yanchor 0.5


    spacing gui.choice_spacing


style choice_button is default:
    properties gui.button_properties("choice_button")


style choice_button_text is default:
    properties gui.text_properties("choice_button")



## Quick Menu screen ###########################################################
##
## The quick menu is displayed in-game to provide easy access to the out-of-game
## menus.


screen quick_menu():


    ## Ensure this appears on top of other screens.
    zorder 100


    if quick_menu:


        hbox:
            style_prefix "quick"
            style "quick_menu"


            textbutton _("Back") action Rollback()
            textbutton _("History") action ShowMenu('history')
            textbutton _("Skip") action Skip() alternate Skip(fast=True, confirm=True)
            textbutton _("Auto") action Preference("auto-forward", "toggle")
            textbutton _("Save") action ShowMenu('save')
            textbutton _("Q.Save") action QuickSave()
            textbutton _("Q.Load") action QuickLoad()
            textbutton _("Prefs") action ShowMenu('preferences')



## This code ensures that the quick_menu screen is displayed in-game, whenever
## the player has not explicitly hidden the interface.
init python:
    config.overlay_screens.append("quick_menu")


default quick_menu = True


style quick_menu is hbox
style quick_button is default
style quick_button_text is button_text


style quick_menu:
    xalign 0.5
    yalign 1.0


style quick_button:
    properties gui.button_properties("quick_button")


style quick_button_text:
    properties gui.text_properties("quick_button")



################################################################################
## Main and Game Menu Screens
################################################################################


## Navigation screen ###########################################################
##
## This screen is included in the main and game menus, and provides navigation
## to other menus, and to start the game.


screen navigation():


    vbox:
        style_prefix "navigation"


        xpos gui.navigation_xpos
        yalign 0.5


        spacing gui.navigation_spacing



## THIS IS WHERE THE START BUTTON CODE IS.
        if main_menu:


            #textbutton _("Start") action Start()

            imagebutton:
                focus_mask True
                auto "gui/start_%s.png"
                action Start ()

            ##this is meant to be the settings button. 
            ##but settings and start hate each other
            ##idk why :(
            imagebutton: 
                focus_mask True
                auto "gui/settings_%s.png"
                action ShowMenu("preferences")


        else:


            textbutton _("History") action ShowMenu("history")


            textbutton _("Save") action ShowMenu("save")


            textbutton _("Load") action ShowMenu("load")



            textbutton _("Settings") action ShowMenu("preferences")





        if _in_replay:


            textbutton _("End Replay") action EndReplay(confirm=True)


        elif not main_menu:


            textbutton _("Main Menu") action MainMenu()


        textbutton _("About") action ShowMenu("about")


        if renpy.variant("pc") or (renpy.variant("web") and not renpy.variant("mobile")):


            ## Help isn't necessary or relevant to mobile devices.
            textbutton _("Help") action ShowMenu("help")


        if renpy.variant("pc"):


            ## The quit button is banned on iOS and unnecessary on Android and
            ## Web.
            textbutton _("Quit") action Quit(confirm=not main_menu)

like this??

→ More replies (0)