[SOLVED]How do you show images in a screen textbutton?

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
MilywayObree
Newbie
Posts: 17
Joined: Sun Jan 28, 2018 11:24 am
Completed: None so far, pending to be exact
Projects: DDLC, The notebook and other secret projects
Organization: Vocastin/Oriaa Pro-Creations
Deviantart: MexicoRPelino
Github: HizashiroTakahashi
Skype: PixelMINEGaming
Location: Philippines
Contact:

[SOLVED]How do you show images in a screen textbutton?

#1 Post by MilywayObree »

Well I know this is just a simple question but Ren'py is freaking me out at some times... But again how do you like show images with screen textbuttons like for example:

Code: Select all

screen select_music():
    modal True
    add "music_overlay"
    add "pause_noclick"
    add "play_noclick"
    add "noMusic"
    textbutton _("{size=38}Return{/size}") action [ Hide(screen="select_music"), Hide(screen="menu_bg", transition=Dissolve(0.75)) ] xpos 40 ypos 670:
        hover_sound "gui/sfx/hover.ogg"
        activate_sound "gui/sfx/select.ogg"
    textbutton _("{size=30}Your Reality{/size} {size=20}Jillian Ashcraft{/size}") action [ Play('music', 'bgm/credits.ogg'), SetVariable("nopause_click", (False)), SetVariable("noplay_click", (True)), SetVariable("noMusic", (True)) ] xpos 450 ypos 30:
        hover_sound "gui/sfx/hover.ogg"
        activate_sound "gui/sfx/select.ogg"
    textbutton _("{size=30}The Crush Song{/size} {size=20}Twaimz{/size}") action [ Play('music', 'playlist/Meme - The crush song.mp3'), SetVariable("nopause_click", (False)), SetVariable("noplay_click", (True)), SetVariable("noMusic", (True)) ] xpos 475 ypos 65:
        hover_sound "gui/sfx/hover.ogg"
        activate_sound "gui/sfx/select.ogg"                                                                                                                                                                                  #Supposed to be a .m4a file but ren'py does not support .m4a music files :(
    textbutton _("{size=30}Doki Doki Forever Instrumental{/size} {size=20}Rachie, Or3o, Chi Chi,\n                                                                                 Kathy-chan{/size}") action [ Play('music', 'playlist/ddfin.ogg'), SetVariable("nopause_click", (False)), SetVariable("noplay_click", (True)), SetVariable("noMusic", (True)) ] xpos 280 ypos 100:
        hover_sound "gui/sfx/hover.ogg"
        activate_sound "gui/sfx/select.ogg"
    textbutton _("{size=30}...{/size}") action [ Hide(screen="select_music"), Show(screen="select_music2") ] xpos 620 ypos 140:
        hover_sound "gui/sfx/hover.ogg"
        activate_sound "gui/sfx/select.ogg"
    if nopause_click == False:
        textbutton _("{size=40}Pause{/size}") action [ PauseAudio('music', value=True), SetVariable("nopause_click", (True)), SetVariable("noplay_click", (False)) ] xpos 480 ypos 435:
            hover_sound "gui/sfx/hover.ogg"
            activate_sound "gui/sfx/select.ogg"
    if noplay_click == False:
        textbutton _("{size=40}Play{/size}") action [ PauseAudio('music', value=False), SetVariable("noplay_click", (True)), SetVariable("nopause_click", (False)) ] xpos 690 ypos 435:
            hover_sound "gui/sfx/hover.ogg"
            activate_sound "gui/sfx/select.ogg"
    if noMusic == True:
        textbutton _("{size=30}No Music{/size}") action [ Stop('music', fadeout=1.0), SetVariable("nopause_click", (True)), SetVariable("noplay_click", (True)), SetVariable("noMusic", (False)) ] xpos 40 ypos 630:
            hover_sound "gui/sfx/hover.ogg"
            activate_sound "gui/sfx/select.ogg"
    null height (4 * gui.pref_spacing)
    hbox:
        style_prefix "slider"
        box_wrap True
        vbox:
            if volume.bar_musicsec == True:
                label _("Music Volume") xpos 480 ypos 435

                hbox:
                    bar value Preference("music volume") xpos 480 ypos 435

screen select_music2():
    modal True
    add "music_overlay"
    add "pause_noclick"
    add "play_noclick"
    add "noMusic"
    textbutton _("{size=38}Return{/size}") action [ Hide(screen="select_music2"), Hide(screen="menu_bg", transition=Dissolve(0.75)) ] xpos 40 ypos 670:
        hover_sound "gui/sfx/hover.ogg"
        activate_sound "gui/sfx/select.ogg"
    textbutton _("{size=30}Your Reality Remix{/size} {size=20}Mirai ft. Jillian Ashcraft{/size}") action [ Play('music', 'playlist/yrmirai.mp3'), SetVariable("nopause_click", (False)), SetVariable("noplay_click", (True)), SetVariable("noMusic", (True)) ] xpos 360 ypos 30:
        hover_sound "gui/sfx/hover.ogg"
        activate_sound "gui/sfx/select.ogg"
    textbutton _("{size=30}Doki Doki and Sayonara Mix{/size} {size=20}Mod Creator{/size}") action [ Play('music', 'playlist/sdd.mp3'), SetVariable("nopause_click", (False)), SetVariable("noplay_click", (True)), SetVariable("noMusic", (True)) ] xpos 355 ypos 65:
        hover_sound "gui/sfx/hover.ogg"
        activate_sound "gui/sfx/select.ogg"                                                                                                                                                                                
    textbutton _("{size=30}Unknown{/size} {size=20}Unknown{/size}") action [ Play('music', 'bgm/d.ogg'), SetVariable("nopause_click", (False)), SetVariable("noplay_click", (True)), SetVariable("noMusic", (True)) ] xpos 515 ypos 100:
        hover_sound "gui/sfx/hover.ogg"
        activate_sound "gui/sfx/select.ogg"
    textbutton _("{size=30}...{/size}") action [ Hide(screen="select_music2"), Show(screen="select_music") ] xpos 620 ypos -20:
        hover_sound "gui/sfx/hover.ogg"
        activate_sound "gui/sfx/select.ogg"
    if nopause_click == False:
        textbutton _("{size=40}Pause{/size}") action [ PauseAudio('music', value=True), SetVariable("nopause_click", (True)), SetVariable("noplay_click", (False)) ] xpos 480 ypos 435:
            hover_sound "gui/sfx/hover.ogg"
            activate_sound "gui/sfx/select.ogg"
    if noplay_click == False:
        textbutton _("{size=40}Play{/size}") action [ PauseAudio('music', value=False), SetVariable("noplay_click", (True)), SetVariable("nopause_click", (False)) ] xpos 690 ypos 435:
            hover_sound "gui/sfx/hover.ogg"
            activate_sound "gui/sfx/select.ogg"
textbutton _("Show image for ddlc poster!") action <------ insert comand to show images here!

Code: Select all

if noMusic == True:
            textbutton _("{size=30}No Music{/size}") action [ Stop('music', fadeout=1.0), SetVariable("nopause_click", (True)), SetVariable("noplay_click", (True)), SetVariable("noMusic", (False)) ] xpos 40 ypos 630:
            hover_sound "gui/sfx/hover.ogg"
            activate_sound "gui/sfx/select.ogg"
    #textbutton _("{size=40}Pause{/size}") action PauseAudio('music', value=False):
        #hover_sound "gui/sfx/hover.ogg"
        #activate_sound "gui/sfx/select.ogg"
    null height (4 * gui.pref_spacing)
    hbox:
        style_prefix "slider"
        box_wrap True
        vbox:
            if volume.bar_musicsec == True:
                label _("Music Volume") xpos 480 ypos 435

                hbox:
                    bar value Preference("music volume") xpos 480 ypos 435
Last edited by MilywayObree on Sat Feb 24, 2018 5:26 am, edited 2 times in total.
Just Monika.

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: How do you show images in a screen textbutton?

#2 Post by rayminator »

you want to us an imagebutton instead of a textbutton

something like this

Code: Select all

imagebutton idle im.Scale("your_image.png", 129, 250) hover im.Scale("your_image.png", 129, 250) action ShowMenu("Your_Page")

User avatar
xavimat
Eileen-Class Veteran
Posts: 1460
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: How do you show images in a screen textbutton?

#3 Post by xavimat »

rayminator wrote: Wed Feb 21, 2018 10:45 amyou want to us an imagebutton instead of a textbutton
I've understood OP's question in another way.

To show an image when clicking on a button you can Show("other_screen_with_the_image") or ShowTransient("other_screen_with_the_image")

Note that the other screen needs a method to be hidden (for example, a transparent button the size of the entire screen to hide it).
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
MilywayObree
Newbie
Posts: 17
Joined: Sun Jan 28, 2018 11:24 am
Completed: None so far, pending to be exact
Projects: DDLC, The notebook and other secret projects
Organization: Vocastin/Oriaa Pro-Creations
Deviantart: MexicoRPelino
Github: HizashiroTakahashi
Skype: PixelMINEGaming
Location: Philippines
Contact:

Re: How do you show images in a screen textbutton?

#4 Post by MilywayObree »

Ok thanks for the help, I have already used the show screen with the image thing before you even commented but anyway, thanks!
Just Monika.

Post Reply

Who is online

Users browsing this forum: Google [Bot]