[SOLVED] Changing fonts for a custom window
Posted: Mon Sep 20, 2021 9:09 am
Been tinkering around with Ren'Py lately, and I decided to make both gui.rpy and screens.rpy from scratch in order to better understand the engine. I kind of get how some things work now, but currently I'm stuck on how to change the font for the text in a custom window I named (following the default say screen format). Usually I just modify it using define gui.name_text_font = "DejaVuSans.ttf" but due to my window being renamed I can't do that anymore.
Here's the code (so far) for my new screens.rpy:
while here's the (currently non working) code for my gui.rpy
I'm specifically asking on how to change the text in the window with id nameBox. Since text cannot be modified through style, I tried using the code in my gui.rpy but it doesn't seem to work. I looked through previous posts in the forum but none of them don't seem to be similar to my case (or are outdated)
Secondary question: How do I make it so that I can "define" a custom made text/window/frame through gui.rpy? Is properties gui.text_properties("nameBox_style") not the correct way to do it?
I really want to learn the engine thoroughly and not just modify variables since I'm eager to make a amazing things with it. Any help would be greatly appreciated.
Here's the code (so far) for my new screens.rpy:
Code: Select all
screen say(who,what):
window:
id "sayBox"
style "sayBox_style"
##### if who has value, also display window id nameBox #####
if who is not None:
window:
id "nameBox"
style "nameBox_style"
text who id "who_s"
text what id "what"
style sayBox_style:
#anchor
xanchor 0
yanchor 0
#position
xpos 0
ypos 500
#size
xsize 500
ysize 200
style nameBox_style:
properties gui.text_properties("nameBox_style")
#anchor
xanchor 0
yanchor 0
#position
xpos 0
yoffset -50
#size
xsize 500
ysize None
background "#000000"
Code: Select all
init python:
gui.init(1280, 720)
define gui.nameBox_style_text_font = "RobotoCondensed-Bold.ttf"
Secondary question: How do I make it so that I can "define" a custom made text/window/frame through gui.rpy? Is properties gui.text_properties("nameBox_style") not the correct way to do it?
I really want to learn the engine thoroughly and not just modify variables since I'm eager to make a amazing things with it. Any help would be greatly appreciated.