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.
-
teamkhaleesi
- Newbie
- Posts: 2
- Joined: Mon Jun 06, 2022 3:41 pm
-
Contact:
#1
Post
by teamkhaleesi » Mon Jun 06, 2022 5:09 pm
Hi.
Does anyone know whether it's possible to add background to an input text? I'm trying to create a windows' login screen and I would like the player to type in the username under the profile icon and add a background to the text input that way the player inputs their name.
You can see my example in the attachments.
Any help is very much appreciated!

-
Attachments
-

-
m_from_space
- Veteran
- Posts: 302
- Joined: Sun Feb 21, 2021 3:36 am
-
Contact:
#2
Post
by m_from_space » Tue Jun 07, 2022 1:29 am
Just use a "frame" as part of a login screen that you create yourself.
Code: Select all
screen login:
modal True
frame:
background "loginbg" # if the image is called loginbg.jpg / loginbg.png inside your images folder
xfill True yfill True
input default "Enter character name" xalign 0.5 yalign 0.5
label start:
call screen login
if _return == "Eileen":
"Welcome, Eileen."
else:
jump start
Here is a list of objects you can create inside screens:
https://www.renpy.org/doc/html/screens.html
-
Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
-
Contact:
#3
Post
by Imperf3kt » Tue Jun 07, 2022 3:35 am
You could also style the input screen, assuming this is the only instance you would use it.
https://www.renpy.org/doc/html/screen_s ... html#input
m_from_space wrote: ↑Tue Jun 07, 2022 1:29 am
Code: Select all
label start:
call screen login
if _return == "Eileen":
"Welcome, Eileen."
else:
jump start
You could tidy this code a bit more by simply doing
Code: Select all
label start:
call screen login
"Welcome, [_return]."
else:
jump start
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project:
GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
-
m_from_space
- Veteran
- Posts: 302
- Joined: Sun Feb 21, 2021 3:36 am
-
Contact:
#4
Post
by m_from_space » Tue Jun 07, 2022 3:56 am
Imperf3kt wrote: ↑Tue Jun 07, 2022 3:35 am
You could tidy this code a bit more by simply doing
Code: Select all
label start:
call screen login
"Welcome, [_return]."
else:
jump start
Sheesh, what kind of construction is this? As a programmer I wouldn't call this "tidying", I would call it "make it weird".

I also assume that you want to have different characters loading when the person enters or something like that, so checking for the variables contents will probably happen soon enough.
-
Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
-
Contact:
#5
Post
by Imperf3kt » Tue Jun 07, 2022 9:03 am
m_from_space wrote: ↑Tue Jun 07, 2022 3:56 am
Imperf3kt wrote: ↑Tue Jun 07, 2022 3:35 am
You could tidy this code a bit more by simply doing
Code: Select all
label start:
call screen login
"Welcome, [_return]."
else:
jump start
Sheesh, what kind of construction is this? As a programmer I wouldn't call this "tidying", I would call it "make it weird".

I also assume that you want to have different characters loading when the person enters or something like that, so checking for the variables contents will probably happen soon enough.
It seems to be the way the documentation suggests doing things, at least if somebody was to use the code you supplied. I personally would do it differently altogether.
https://www.renpy.org/doc/html/text.htm ... ating-data
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project:
GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
-
teamkhaleesi
- Newbie
- Posts: 2
- Joined: Mon Jun 06, 2022 3:41 pm
-
Contact:
#6
Post
by teamkhaleesi » Tue Jun 07, 2022 12:53 pm
Hi
Is there any I could make it different? For example, the player inputs a name, and then they asked whether they are sure that they want that name, if yes then move on to next scene. Is that possible?
m_from_space wrote: ↑Tue Jun 07, 2022 1:29 am
Just use a "frame" as part of a login screen that you create yourself.
Code: Select all
screen login:
modal True
frame:
background "loginbg" # if the image is called loginbg.jpg / loginbg.png inside your images folder
xfill True yfill True
input default "Enter character name" xalign 0.5 yalign 0.5
label start:
call screen login
if _return == "Eileen":
"Welcome, Eileen."
else:
jump start
Here is a list of objects you can create inside screens:
https://www.renpy.org/doc/html/screens.html
-
zmook
- Veteran
- Posts: 421
- Joined: Wed Aug 26, 2020 6:44 pm
-
Contact:
#7
Post
by zmook » Tue Jun 07, 2022 2:07 pm
teamkhaleesi wrote: ↑Tue Jun 07, 2022 12:53 pm
Is there any I could make it different? For example, the player inputs a name, and then they asked whether they are sure that they want that name, if yes then move on to next scene. Is that possible?
Sure, try something like:
Code: Select all
label input_pc_name:
image set_hero_name_bg = "login_screen_bg"
scene set_hero_name_bg
python:
pc_name = renpy.input("Hey, hero, what is your name?", default="Nick", pixel_width=max_name_w)
pc_name = pc_name.strip() or "Nick"
if pc_name in reserved_names:
"Sorry, that name is already in use by a character in the game. Please pick another one!"
jump input_pc_name
menu confirm_pc_name:
caption "Hi, [pc_name]. Are you happy with your name?"
"Yes":
pass
"No":
jump input_pc_name
"Got it. Okay, [pc], you have a story to tell?"
scene black with fade
pc "Oh yes, do I ever."
return
'renpy.input()' uses the 'input' screen defined in screens.rpy. You can edit that however you like to change the look&feel of the dialog.
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM
Users browsing this forum: Bing [Bot], Google [Bot], minyan