[SOLVED]How to use an image as a label

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
Alaspooralice
Newbie
Posts: 7
Joined: Sun Dec 31, 2023 5:18 pm
Contact:

[SOLVED]How to use an image as a label

#1 Post by Alaspooralice »

In my preferences menu I want to make the labels for the options into images instead of text. So for example the default code where you can change the game from fullscreen to window mode is

Code: Select all

                    
	vbox:
		style_prefix "radio"
		label _("Display")
		textbutton _("Window") action Preference("display", "window")
		textbutton _("Fullscreen") action Preference("display", "fullscreen")
so where the label would normally appear I want to place an image that would work as a label. I tried defining the image and using "show" but I get this error:

Code: Select all

File "game/screens.rpy", line 829: 'show' is not a keyword argument or valid child for the vbox statement.
    show display
Basically I just commented out the label and put "show display" in the same spot after defining the image and it didn't work so now I'm confused.
Last edited by Alaspooralice on Thu Jan 04, 2024 12:00 pm, edited 1 time in total.

User avatar
m_from_space
Miko-Class Veteran
Posts: 975
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: How to use an image as a label

#2 Post by m_from_space »

Alaspooralice wrote: Wed Jan 03, 2024 11:11 pm Basically I just commented out the label and put "show display" in the same spot after defining the image and it didn't work so now I'm confused.
I'm not confused, because as the error says, "show" is not a valid statement inside a screen. :) Here is what you can put inside a screen: https://www.renpy.org/doc/html/screens.html

To add an image to a screen, you have to use the keyword "add". The keyword "show" relates to images shown as part of labels.

Code: Select all

screen myscreen():
    vbox:
        add "myimage"

User avatar
Alaspooralice
Newbie
Posts: 7
Joined: Sun Dec 31, 2023 5:18 pm
Contact:

Re: How to use an image as a label

#3 Post by Alaspooralice »

m_from_space wrote: Thu Jan 04, 2024 3:49 am
Alaspooralice wrote: Wed Jan 03, 2024 11:11 pm Basically I just commented out the label and put "show display" in the same spot after defining the image and it didn't work so now I'm confused.
I'm not confused, because as the error says, "show" is not a valid statement inside a screen. :) Here is what you can put inside a screen: https://www.renpy.org/doc/html/screens.html

To add an image to a screen, you have to use the keyword "add". The keyword "show" relates to images shown as part of labels.

Code: Select all

screen myscreen():
    vbox:
        add "myimage"
Omggg thank you hahaha! I'll have to bookmark that page because I can never find it!

Post Reply

Who is online

Users browsing this forum: Semrush [Bot]