Ui alignment

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
bobbk
Regular
Posts: 46
Joined: Tue Feb 09, 2010 8:36 am
Contact:

Ui alignment

#1 Post by bobbk »

Hey all,

Having trouble figuring out how to get a UI to align with columns and rows. I want each cell to be the same width as the ones above it, but I can't figure out how. I tried using xminumum but that's not working, as you can see the window is still a few pixels shifted:

image:
Image

code:

Code: Select all

    python:
        ui.window (xmargin=.1, ymargin=.9, xalign=.5, yalign=.5)
        ui.vbox ()
        ui.hbox ()
        ui.textbutton ("BUY", clicked=None)
        ui.text("$400", style=style.vampire, color="#fffc00")
        ui.frame (background = "#00ff1e", xminimum=300)
        ui.text("  Cheap Leather Wardrobe")
        ui.text("    +25 Max Charm", color="#00ff1e")
        ui.text("    Adds $10.00 to Expenses", color="#ff0000")
        ui.close ()
        ui.hbox ()
        ui.textbutton ("BUY", clicked=None)
        ui.text("$400", style=style.vampire, color="#fffc00")
        ui.frame (background = "#00ff1e", xminimum=300)
        ui.text("  Leather Wardrobe")
        ui.text("    +25 Max Charm", color="#00ff1e")
        ui.text("    Adds $10.00 to Expenses", color="#ff0000")
        ui.null(height=20)
        ui.close()
        ui.close ()

Asphodel
Regular
Posts: 28
Joined: Sat Jan 17, 2009 1:40 am
Contact:

Re: Ui alignment

#2 Post by Asphodel »

Try setting xmaximum as well, like this:

Code: Select all

ui.window (xmargin=.1, ymargin=.9, xalign=.5, yalign=.5)
        ui.vbox ()
        ui.hbox ()
        ui.textbutton ("BUY", clicked=None)
        ui.text("$400", style=style.centered_text, color="#fffc00")
        ui.frame (background = "#00ff1e", xminimum=300, xmaximum=300)
        ui.text("  Cheap Leather Wardrobe with a Very Long Name for Purposes of Demonstration")
        ui.text("    +25 Max Charm", color="#00ff1e")
        ui.text("    Adds $10.00 to Expenses", color="#ff0000")
        ui.close ()
        ui.hbox ()
        ui.textbutton ("BUY", clicked=None)
        ui.text("$400", style=style.centered_text, color="#fffc00")
        ui.frame (background = "#00ff1e", xminimum=300, xmaximum=300)
        ui.text("  shortname")
        ui.text("    +25 Max Charm", color="#00ff1e")
        ui.text("    Adds $10.00 to Expenses", color="#ff0000")
        ui.null(height=20)
        ui.close()
        ui.close ()

bobbk
Regular
Posts: 46
Joined: Tue Feb 09, 2010 8:36 am
Contact:

Re: Ui alignment

#3 Post by bobbk »

lol xmaximum wasn't listed on http://www.renpy.org/wiki/renpy/doc/ref ... Properties so I thought it didn't exist... I should have tried it anyways :P

yeah that works for me!

Asphodel
Regular
Posts: 28
Joined: Sat Jan 17, 2009 1:40 am
Contact:

Re: Ui alignment

#4 Post by Asphodel »

Also, if you're using text long enough to get wrapped, you'll probably want to use left_padding or xpadding rather than spaces in the item name.

bobbk
Regular
Posts: 46
Joined: Tue Feb 09, 2010 8:36 am
Contact:

Re: Ui alignment

#5 Post by bobbk »

Yeah i'm familiar with columns in HTML and this is really similar, i was just using spaces until I could get the fixed sizes figured out.

thanks again!

duanemoody
Regular
Posts: 100
Joined: Fri Oct 02, 2009 2:32 pm
Projects: American Jurassic
Organization: Pier 7 Media
Location: Arizona
Contact:

Re: Ui alignment

#6 Post by duanemoody »

bobbk wrote:lol xmaximum wasn't listed on http://www.renpy.org/wiki/renpy/doc/ref ... Properties
It's listed now.

Post Reply

Who is online

Users browsing this forum: Google [Bot], haitai, Starberries