Customizing Choice Menu? How do?

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
Giovedi
Regular
Posts: 147
Joined: Sun Sep 09, 2012 6:20 am
Contact:

Customizing Choice Menu? How do?

#1 Post by Giovedi »

I'm having trouble messing around with the choice menu buttons. I know how to get rid of the button background/frame and change the font, but that's it.

How would I go about repositioning or reskinning the buttons? This isn't for anything specific; I just wanna know for reference since I'm brushing up on my GUI-making skills.

Thanks! :)

User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: Customizing Choice Menu? How do?

#2 Post by OokamiKasumi »

Giovedi wrote:I'm having trouble messing around with the choice menu buttons. I know how to get rid of the button background/frame and change the font, but that's it.

How would I go about repositioning or reskinning the buttons? This isn't for anything specific; I just wanna know for reference since I'm brushing up on my GUI-making skills.

Thanks! :)
You begin by going to the Cookbook section of the forum where all the tutorials are stored and reading this tutorial: [Tutorial] Customizing Menus. This will give you all the basics of how ALL the buttons can be changed, including the Choice buttons.

Changing the choice buttons to your personal graphics is as simple as making your graphic and adding it in right UNDER the screen choice code.

Code: Select all

###################################################################
init -2:
    $ config.narrator_menu = True

    ## ----- Button Background ------------------------------------- 
    style menu_choice_button is button:
        background Frame("ui/choice_bg_idle.png",0,0)
        hover_background  Frame("ui/choice_bg_hover.png",0,0)
    
    # Sets Max Widths
        xminimum int(config.screen_width * 0.45)
        xmaximum int(config.screen_width * 0.45)

    #Sets minimum height -- recommend exact height of your button image    
        yminimum 60
        ypadding 5
        xpadding 5
Positions for the buttons are adjusted in screens.rpy. here:

Code: Select all

screen choice:
    window: 
        style "menu_window"        
        xalign 0.5
        yalign 0.5
If you want Two Rows of buttons, like this:
FW03.jpg
You'll need to change your 'screen choice' code to something like this:

Code: Select all

##############################################################################
# Choice
screen choice:
    window:
        style "menu_window"       
        xalign 0.5
        yalign 0.5
       
        $i = 0
       
        hbox:
            spacing 2
            vbox:
                style "menu"
                spacing 2
                 
                for caption, action, chosen in items:
                    $i += 1
                    if i % 2 == 1:
                        if action: 
                             
                            button:
                                action action
                                style "menu_choice_button"                       
                               
                                text caption style "menu_choice"
                             
                        else:
                            text caption style "menu_caption"
           
            if i % 2 == 0:
                $i = 1
            else:
                $i = 1               
                            
            vbox:
                style "menu"
                spacing 2
                 
                for caption, action, chosen in items:
                    $i += 1
                    if i % 2 == 1:
                        if action: 
                             
                            button:
                                action action
                                style "menu_choice_button"                     
                               
                                text caption style "menu_choice"
                             
                        else:
                            text caption style "menu_caption"

screen choice2:
    window: 
        style "menu_window"        
        xalign 0.5
        yalign 0.5
         
        vbox:
            style "menu"
            spacing 5
            
            for caption, action, chosen in items:
                 
                if action:  
                    
                    button:
                        action action
                        style "menu_choice_button"                        
 
                        text caption style "menu_choice"
                     
                else:
                    text caption style "menu_caption"


##########################################################################
init -2:
    $ config.narrator_menu = True
    
    # Menu Choice Buttons -----------------------------------

    ## ----- Menu Choice Background -----------------
    # The frame around the buttons. 
    style menu_window:
        is default

    ## ----- Button Text ------------------------------
    style menu_choice is button_text:
        # font  "fo/AZOTE.TTF"
        size  22
        color  "#ffcc66"
        hover_color  "#ffffff"

        xalign 0.5
        yalign 0.5

        outlines  [(1, "#330000", 0, 0)]        
        hover_outlines  [(1, "#660066", 0, 0)]

        drop_shadow  [(2, 2)] 
        drop_shadow_color "#663300"

    ## ----- Button Background ------------------------------------- 
    style menu_choice_button is button:
        background Frame("ui/choice_bg_idle.png",0,0)
        hover_background  Frame("ui/choice_bg_hover.png",0,0)
    
    # Sets Max Widths
        xminimum int(config.screen_width * 0.55)
        xmaximum int(config.screen_width * 0.55)

    #Sets minimum height -- recommend exact height of your button image    
        yminimum 60
        ypadding 5
        xpadding 5
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

Giovedi
Regular
Posts: 147
Joined: Sun Sep 09, 2012 6:20 am
Contact:

Re: Customizing Choice Menu? How do?

#3 Post by Giovedi »

Thanks -- the cookbook tutorials confused me, see, because I'm not all that good at this stuff. I appreciate your explanation!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], Lohre