text with imagebutton is posible?

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
johandark
Veteran
Posts: 346
Joined: Sat Apr 30, 2016 11:04 am
Completed: Wild Guards, In Dreams
Projects: Pact with a witch
Deviantart: johandarkweb
Location: Barcelona
Contact:

text with imagebutton is posible?

#1 Post by johandark » Mon Oct 10, 2016 2:12 pm

screenshot0003.jpg
A closer look:
screenshot0004.jpg
screenshot0004.jpg (13.39 KiB) Viewed 6242 times

Code: Select all

screen main_menu():

        vbox:
            text "[config.name!t]":
                style "main_menu_title"

            text "[config.version]":
                style "main_menu_version"
                
            text _("{size=22}(No disponible aún){/size}{a=http://gamejolt.com/games/pact-with-a-witch-nsfw/192330}{image=gui/icons/patreon.png}")
            imagebutton idle 'gui/icons/patreon.png'  hover "gui/icons/patreon_h.png"  action OpenURL("http://gamejolt.com/games/pact-with-a-witch-nsfw/192330")
So here is the problem.

I would like to use a text "Not avaible yet" and next an "imagebutton" that changes of color when the mouse is over (hovered).

I also have this window with the same problem:
screenshot0006.jpg
Using this code:

Code: Select all

        vbox:
            
            text "{size=20}JONNYMELABO PRODUCTIONS 2016©{/size}\n"
            
            
            label _("{a=http://gamejolt.com/games/pact-with-a-witch-nsfw/192330}{size=30}[config.name!t]{/size}{/a}")
            text _("Versión [config.version!t]\n")
            
            text _("{image=gui/icons/patreon.png} {size=30}Patreon{/size}  {size=22}del proyecto. (Aún no disponible).{/size}")
            text _("{a=http://gamejolt.com/games/pact-with-a-witch-nsfw/192330}{image=gui/icons/gamejolt.png} {size=18}GameJolt{/size}{/a} {size=22}del proyecto.{/size}")
            text _("{a=https://www.facebook.com/johandarkart/}{image=gui/icons/facebook.png} {size=18}Facebook{/size}{/a}  {size=22}de JohanDark.{/size}")
            text _("{a=https://www.artstation.com/artist/johandark}{image=gui/icons/artstation.png} {size=18}Artstation{/size}{/a}  {size=22}de JohanDark.{/size}")
            text _("{a=http://johandarkweb.deviantart.com/}{image=gui/icons/deviantart.png} {size=18}DeviantArt{/size}{/a}  {size=22}de JohanDark.{/size}")
            text _("{a=http://www.newgrounds.com/portal/view/559210}{image=gui/icons/newgrounds.png} {size=18}NewGrounds{/size}{/a}  {size=22}primer videojuego erótico en Flash.{/size}\n\n{size=20}(Quedó sin terminar por desconocimiento de programación).{/size}\n")
            
            text "{image=gui/icons/line.png}"
            ## gui.about is usually set in options.rpy.
            if gui.about:
                text "[gui.about!t]"
            text _("{size=18}Made with {a=https://www.renpy.org/}Ren'Py{/a} [renpy.version_only].\n\n[renpy.license!t]{/size}")
Is it possible add idle image and hover image with a "link" and with text?

Thanks!
Image

User avatar
johandark
Veteran
Posts: 346
Joined: Sat Apr 30, 2016 11:04 am
Completed: Wild Guards, In Dreams
Projects: Pact with a witch
Deviantart: johandarkweb
Location: Barcelona
Contact:

Re: text with imagebutton is posible?

#2 Post by johandark » Fri Oct 14, 2016 6:35 am

Is not possible?
Image

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: text with imagebutton is posible?

#3 Post by Ocelot » Fri Oct 14, 2016 7:26 am

Why not a simple button with text styled differently for unhovered and hovered state?
< < insert Rick Cook quote here > >

User avatar
Donmai
Eileen-Class Veteran
Posts: 1919
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: text with imagebutton is posible?

#4 Post by Donmai » Fri Oct 14, 2016 8:26 am

Yes, text buttons will save you precious memory, too. You can use them with something like:

Code: Select all

    style mm_button:
        background None #removes the button background

    style mm_button_text:
        drop_shadow (1, 1)
        drop_shadow_color '#000'
        color "#FFF" 
        hover_color "#F00" 
        insensitive_color "#999"
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
gas
Miko-Class Veteran
Posts: 838
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: text with imagebutton is posible?

#5 Post by gas » Fri Oct 14, 2016 7:37 pm

Yes! That's really possible.
Just use the BUTTON screen language item.
Add to this an hbox, then the icon and the text to the hbox.
BUTTON is done to have any area of the screen react as a single button. In that given case, the hbox.
ALL the button childrens get the hovered status if the parent (the button) enter the hover status.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
johandark
Veteran
Posts: 346
Joined: Sat Apr 30, 2016 11:04 am
Completed: Wild Guards, In Dreams
Projects: Pact with a witch
Deviantart: johandarkweb
Location: Barcelona
Contact:

Re: text with imagebutton is posible?

#6 Post by johandark » Sat Oct 15, 2016 6:24 am

Ocelot wrote:Why not a simple button with text styled differently for unhovered and hovered state?
Could you please code it to understand you better? Thanks! Sorry for my horrible knowledge of programming.
gas wrote:Yes! That's really possible.
Just use the BUTTON screen language item.
Add to this an hbox, then the icon and the text to the hbox.
BUTTON is done to have any area of the screen react as a single button. In that given case, the hbox.
ALL the button childrens get the hovered status if the parent (the button) enter the hover status.
Same here... I did not understand a single thing...

Donmai wrote:Yes, text buttons will save you precious memory, too. You can use them with something like:
Code:

Code: Select all

    style mm_button:
        background None #removes the button background

    style mm_button_text:
        drop_shadow (1, 1)
        drop_shadow_color '#000'
        color "#FFF" 
        hover_color "#F00" 
        insensitive_color "#999"
Here you are talking about text... but I´m more interested in "mm_button"

Here you are saying to "removes the background"... Is that mean... when mouse is over icon will desapear?

and later... how is it implemented?

Code: Select all

text style=mm_button _("{a=https://www.facebook.com/johandarkart/}{image=gui/icons/facebook.png} {size=18}Facebook{/size}{/a}  {size=22}de JohanDark.{/size}")
It doesn´t work for me...

Again sorry for my poor knowledge...
Image

User avatar
xavimat
Eileen-Class Veteran
Posts: 1458
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: text with imagebutton is posible?

#7 Post by xavimat » Mon Oct 17, 2016 4:03 am

Look at the "button" documentation: https://www.renpy.org/doc/html/screens.html#button

- There are "textbuttons" with only text (and backgrounds, that can be a single image too).
- There are "imagebuttons" with images.
- But there are also "buttons" that are "containers" where you can put a lot of elements (text and images, boxes, etc.), and all of them are part of the same button. For your question, I presume that's what you want.

Take a look at the "screen file_slots()" in the "screens.rpy" file to see some examples of "buttons".
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
johandark
Veteran
Posts: 346
Joined: Sat Apr 30, 2016 11:04 am
Completed: Wild Guards, In Dreams
Projects: Pact with a witch
Deviantart: johandarkweb
Location: Barcelona
Contact:

Re: text with imagebutton is posible?

#8 Post by johandark » Thu Nov 03, 2016 3:30 pm

Could somebody explain me that in a code example... because I can´t resolve this problem... :(

Thanks!
Image

User avatar
xavimat
Eileen-Class Veteran
Posts: 1458
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: text with imagebutton is posible?

#9 Post by xavimat » Fri Nov 04, 2016 3:58 am

I've already suggested to have a look to the "screen file_slots(title)" in screens.rpy.

Here the code of the button than can help you:

Code: Select all

                    button:
                        action FileAction(slot)

                        has vbox

                        add FileScreenshot(slot) xalign 0.5

                        text FileTime(slot, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty slot")):
                            style "slot_time_text"

                        text FileSaveName(slot):
                            style "slot_name_text"

                        key "save_delete" action FileDelete(slot)
As you see, there is a "button:" statement and, inside, different elements (action, has vbox, add, text, text, key). The "has vbox" part organizes the following elements vertically, without that, all elements would be one over another. I think that's what you need:

Code: Select all

screen mybutton():
    button:
        action NullAction()
        add "imagebutton.png"
        text "The text of the button" align (.5, .5)
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)

Post Reply

Who is online

Users browsing this forum: No registered users