Custom Textbox Text Placement

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
User avatar
yaelso
Newbie
Posts: 23
Joined: Sat Aug 23, 2014 11:37 pm
Projects: From the Sugar Plum Kingdom
Tumblr: yaelso
Deviantart: yaelso
itch: yaelso
Contact:

Custom Textbox Text Placement

#1 Post by yaelso »

Firstly put, I am pretty new to both Ren'Py itself as well as the forums, so I'm still in the process of learning proper coding!
While working on a custom textbox for one of my games, I managed to adjust the padding so that it looked exactly as I had designed in the mockup--which wasn't too difficult, but something caused the text to sink down to the very bottom. All in all, I was aiming to have the names listed in the first scroll and have the body-text begin around halfway to said scroll's right. I did not have this issue before implementing the custom box, and I haven't worked on anything else today.

I've combed over the code quite a few times now, but I'm just not sure what is causing the issue or how I should go about fixing it. I followed the initial format examples that were listed in the cookbook, so the textbox section looks as such;

Code: Select all

    style.window.background = Image("gui/tb_ground.png")

    style.window.left_margin = 0
    style.window.right_margin = 0
    style.window.top_margin = 0
    style.window.bottom_margin = 0

    style.window.left_padding = 5
    style.window.right_padding = 0
    style.window.top_padding = 650
    style.window.bottom_padding = 10

    style.window.yminimum = 277
If anyone has any idea as to what I should do, I'd appreciate it! (--Also, for the sake of saying, the screen is 1280 by 720!)
Attachments
errorscreenshot.png

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Custom Textbox Text Placement

#2 Post by philat »

Well, yes, your window has top_padding of 650; that will push down the text. See http://www.w3.org/TR/CSS2/images/boxdim.png (the padding vs. margin difference in renpy is the same as in css).

I don't know why you added padding, but if it was in an attempt to position the textbox correctly, use aligns and pos values instead.

Code: Select all

style say_window:
    yalign 0.98 # xalign/yalign positions textbox at relative values -- here, 98% of the game window's height, or in other words, pretty close to the bottom
    xpos 30 # xpos/ypos positions textbox at absolute pixels from left/top

User avatar
yaelso
Newbie
Posts: 23
Joined: Sat Aug 23, 2014 11:37 pm
Projects: From the Sugar Plum Kingdom
Tumblr: yaelso
Deviantart: yaelso
itch: yaelso
Contact:

Re: Custom Textbox Text Placement

#3 Post by yaelso »

@philat Oh gosh, thanks a bunch! When I initially put it in, the box itself was off kilter and the padding was the only thing I saw mentioned anywhere. I'm really grateful for your help!

User avatar
yaelso
Newbie
Posts: 23
Joined: Sat Aug 23, 2014 11:37 pm
Projects: From the Sugar Plum Kingdom
Tumblr: yaelso
Deviantart: yaelso
itch: yaelso
Contact:

Re: Custom Textbox Text Placement

#4 Post by yaelso »

I feel a little silly again, but I'm still having some issues with the text position. I thought I had things handled at first after adjusting the aforementioned values in place of padding, but now the text is behind the box. That being said, the position itself isn't a problem anymore. It only started up after I worked with the new values, so I'm worried I missed something somewhere since these are new concepts to me! I'm sorry if this is really blatant; I can't really find any good resources aside from Aleema's customization post.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]