Text in Choice Menus Not Centering? [SOLVED]

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.
Message
Author
User avatar
narutochats
Regular
Posts: 27
Joined: Sun Apr 22, 2012 10:02 pm
Contact:

Text in Choice Menus Not Centering? [SOLVED]

#1 Post by narutochats »

Hey all! Messing around in renpy and I set up a custom choice menu box. But I noticed for some reason that my text inside the box isn't centered. I have the proper dimensions for my .png in the code so I don't understand why it's being like this. If anyone could let me know what to do I'd be grateful! I'll upload a picture of what it looks like.

Here is where I have it defined:

Code: Select all

style menu_choice_button:
    background Frame("GUI/choice_idle.png",440,53)
    hover_background Frame("GUI/choice_hover.png",440,53)

And here is what my code looks like in screen choice:

Code: Select all

screen choice(items):

    window:
        style "menu_window"
        xalign 0.5
        yalign 0.9

        vbox:
            style "menu"
            spacing 100

            for caption, action, chosen in items:

                if action:

                    button:
                        action action
                        style "menu_choice_button"
                        xysize(440,53)
                        text caption style "menu_choice"

                else:
                    text caption style "menu_caption"
                    
init:
    $ style.menu_choice.size = 17
Attachments
Screenshot (50).png
Last edited by narutochats on Fri Jul 28, 2017 12:26 am, edited 1 time in total.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Text in Choice Menus Not Centering?

#2 Post by Milkymalk »

Looks pretty centered to me. About 5 "squares" left and right each. Remember that periods are part of the text.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
narutochats
Regular
Posts: 27
Joined: Sun Apr 22, 2012 10:02 pm
Contact:

Re: Text in Choice Menus Not Centering?

#3 Post by narutochats »

Milkymalk wrote:Looks pretty centered to me. About 5 "squares" left and right each. Remember that periods are part of the text.

Oops, I'm sorry! Should've clarified. I meant vertically!. It's a little bit more to the top and it's bothering me :? It looked fine with the default buttons.
I've been at this too long...

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Text in Choice Menus Not Centering?

#4 Post by Milkymalk »

Hm. As a test, make the ysize of the button larger than 53, say, 100. How does that look?
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
narutochats
Regular
Posts: 27
Joined: Sun Apr 22, 2012 10:02 pm
Contact:

Re: Text in Choice Menus Not Centering?

#5 Post by narutochats »

Still does the same thing, just a bigger box :( I played around with other numbers too, and bigger or smaller, it continues doing that.
I've been at this too long...

User avatar
Potato0095
Regular
Posts: 84
Joined: Sun May 08, 2016 8:40 pm
Projects: LoveCraft
itch: potato95
Location: Brazil
Contact:

Re: Text in Choice Menus Not Centering?

#6 Post by Potato0095 »

Change the image's resolution, make in the same width and reduce the height, worked for me the last time I made a project.
"There are two types of lies: Lies that hurt, and lies that don't."

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Text in Choice Menus Not Centering?

#7 Post by Milkymalk »

Workarounds are never the best choice, usually they just make you accept that you don't understand how something works.

The forum is nuts at the moment, I'll come back to the problem when I can use the editor fpr posting.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
narutochats
Regular
Posts: 27
Joined: Sun Apr 22, 2012 10:02 pm
Contact:

Re: Text in Choice Menus Not Centering?

#8 Post by narutochats »

Yeah that didn't work either for me anyways. :cry: Thanks though.
I've been at this too long...

User avatar
narutochats
Regular
Posts: 27
Joined: Sun Apr 22, 2012 10:02 pm
Contact:

Re: Text in Choice Menus Not Centering?

#9 Post by narutochats »

Yeah that didn't work either for me anyways. :cry: Thanks though.
I've been at this too long...

User avatar
Potato0095
Regular
Posts: 84
Joined: Sun May 08, 2016 8:40 pm
Projects: LoveCraft
itch: potato95
Location: Brazil
Contact:

Re: Text in Choice Menus Not Centering?

#10 Post by Potato0095 »

Maybe the font's size? Try making them bigger.
"There are two types of lies: Lies that hurt, and lies that don't."

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Text in Choice Menus Not Centering?

#11 Post by Milkymalk »

What if yu give the text yanchor 0.5 ?
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
narutochats
Regular
Posts: 27
Joined: Sun Apr 22, 2012 10:02 pm
Contact:

Re: Text in Choice Menus Not Centering?

#12 Post by narutochats »

Milkymalk wrote: Sat Jul 22, 2017 9:59 am What if yu give the text yanchor 0.5 ?
Where exactly in the code would I put that? Because putting it under "button" just moves where the buttons are placed.
I've been at this too long...

User avatar
narutochats
Regular
Posts: 27
Joined: Sun Apr 22, 2012 10:02 pm
Contact:

Re: Text in Choice Menus Not Centering?

#13 Post by narutochats »

Potato0095 wrote: Sat Jul 22, 2017 8:32 am Maybe the font's size? Try making them bigger.
Changing the font will only make it bigger or smaller in the same spot.
I've been at this too long...

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Text in Choice Menus Not Centering?

#14 Post by Milkymalk »

narutochats wrote: Sun Jul 23, 2017 7:41 pm
Milkymalk wrote: Sat Jul 22, 2017 9:59 am What if yu give the text yanchor 0.5 ?
Where exactly in the code would I put that? Because putting it under "button" just moves where the buttons are placed.
Sorry, I couldn't get back to you sooner. Put it under "text" so it anchors the text inside the button at 0.5
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
narutochats
Regular
Posts: 27
Joined: Sun Apr 22, 2012 10:02 pm
Contact:

Re: Text in Choice Menus Not Centering?

#15 Post by narutochats »

Milkymalk wrote: Sun Jul 23, 2017 11:32 pm
narutochats wrote: Sun Jul 23, 2017 7:41 pm
Milkymalk wrote: Sat Jul 22, 2017 9:59 am What if yu give the text yanchor 0.5 ?
Where exactly in the code would I put that? Because putting it under "button" just moves where the buttons are placed.
Sorry, I couldn't get back to you sooner. Put it under "text" so it anchors the text inside the button at 0.5
Sorry, I'm a bit of a moron at coding, I'm more of a script kiddie. Where exactly? I don't see any sort of thing in my code that defines the text inside of a button. And I'm not sure where to place that myself.
I've been at this too long...

Post Reply

Who is online

Users browsing this forum: Andredron