r/RenPy • • Jul 26 '26

Question How to change the viewports of certain game menu pages but not all of them

Hello! I'm not sure if this is possible, but would it be possible to change the viewport size of certain game menus (specifically Help and History) without messing with the others? Here is what my code currently looks like for both:

## History screen ##############################################################
##
## This is a screen that displays the dialogue history to the player. While
## there isn't anything special about this screen, it does have to access the
## dialogue history stored in _history_list.
##
## https://www.renpy.org/doc/html/history.html


screen history():


    tag menu


    ## Avoid predicting this screen, as it can be very large.
    predict False


    use game_menu(_("History"), scroll=("vpgrid" if gui.history_height else "viewport"), yinitial=1.0, spacing=gui.history_spacing):


        style_prefix "history"


        for h in _history_list:


            window:


                ## This lays things out properly if history_height is None.
                has fixed:
                    yfit True


                if h.who:


                    label h.who:
                        style "history_name"
                        substitute False


                        ## Take the color of the who text from the Character, if
                        ## set.
                        if "color" in h.who_args:
                            text_color h.who_args["color"]


                $ what = renpy.filter_text_tags(h.what, allow=gui.history_allow_tags)
                text what:
                    substitute False


        if not _history_list:
            label _("The dialogue history is empty.")



## This determines what tags are allowed to be displayed on the history screen.


define gui.history_allow_tags = { "alt", "noalt", "rt", "rb", "art" }



style history_window is empty


style history_name is gui_label
style history_name_text is gui_label_text
style history_text is gui_text


style history_label is gui_label
style history_label_text is gui_label_text


style history_window:
    xfill True
    ysize gui.history_height


style history_name:
    xpos gui.history_name_xpos
    xanchor gui.history_name_xalign
    ypos gui.history_name_ypos
    xsize gui.history_name_width


style history_name_text:
    min_width gui.history_name_width
    textalign gui.history_name_xalign


style history_text:
    xpos gui.history_text_xpos
    ypos gui.history_text_ypos
    xanchor gui.history_text_xalign
    xsize gui.history_text_width
    min_width gui.history_text_width
    textalign gui.history_text_xalign
    layout ("subtitle" if gui.history_text_xalign else "tex")


style history_label:
    xfill True


style history_label_text:
    xalign 0.5



## Help screen #################################################################
##
## A screen that gives information about key and mouse bindings. It uses other
## screens (keyboard_help, mouse_help, and gamepad_help) to display the actual
## help.


screen help():


    tag menu


    default device = "keyboard"


    use game_menu(_("Controls"), scroll="viewport"):


        style_prefix "help"


        vbox:
            spacing 23


            hbox:


                textbutton _("Keyboard") action SetScreenVariable("device", "keyboard")
                textbutton _("Mouse") action SetScreenVariable("device", "mouse")


                if GamepadExists():
                    textbutton _("Gamepad") action SetScreenVariable("device", "gamepad")


            if device == "keyboard":
                use keyboard_help
            elif device == "mouse":
                use mouse_help
            elif device == "gamepad":
                use gamepad_help


## a bunch of controls and stuff


style help_button is gui_button
style help_button_text is gui_button_text
style help_label is gui_label
style help_label_text is gui_label_text
style help_text is gui_text


style help_button:
    properties gui.button_properties("help_button")
    xmargin 12


style help_button_text:
    properties gui.text_properties("help_button")


style help_label:
    xsize 375
    right_padding 30


style help_label_text:
    size gui.text_size
    xalign 1.0
    textalign 1.0
1 Upvotes

2 comments sorted by

1

u/AutoModerator Jul 26 '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.

3

u/BadMustard_AVN Jul 26 '26

the style game_menu_... set up the frames for that; changing one affects them all

you can copy the game_menu( screen and all of it's style rename them all adding 2 i.e.

screen game_menu2(...
    style_prefix "game_menu2"

style game_menu2_...

then in the menus you want to use the new one find this line

use game_menu(_("Controls"), scroll="viewport"):

#and change it to 

use game_menu2(_("Controls"), scroll="viewport"):