Problem with SL imagebutton syntaxis.

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
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Problem with SL imagebutton syntaxis.

#1 Post by Alex »

Hi, folks!
Could someone tell me the right syntaxis for "hover" and "idle" images of an imagebutton.
So, I have some images, declared in init block, and I want to use them for my imagebutton, but I need them to be scaled.
For now I have

Code: Select all

imagebutton:
    idle im.Scale( "my_image.bmp", 50, 50)
    hover im.Scale( "my_image.bmp", 50, 50)
    clicked my_action
It works, but it takes a filename as an argument for idle and hover. And it looks like <im.Scale> unable to use a displayable name (if I change "my_image.bmp" to "my_image", it says that unable to find file, named "my_image").

I've tried

Code: Select all

imagebutton:
    idle "my_image" xzoom 50 yzoom 50
    hover "my_image" xzoom 50 yzoom 50
    clicked my_action
but get an error "u'xzoom' is not a keyword argument or valid child for the imagebutton statement."

Also, tried

Code: Select all

    idle "my_image":
        xzoom 50 yzoom 50
but failed...((

Any thoughts, how could it be done, would be appreciated.
Thanks in advance...))

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Problem with SL imagebutton syntaxis.

#2 Post by PyTom »

Imagebutton doesn't take ATL directly. But you can use a Transform here, to write similar code.

Code: Select all

imagebutton:
    idle Transform("my_image", xzoom=.5, yzoom=.5)
    hover Transform("my_image", xzoom=.5, yzoom=.5)
    clicked my_action
I'm assuming you meant 50% (.5), rather than 5000%.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Problem with SL imagebutton syntaxis.

#3 Post by Alex »

That worked, thank you!
I'm assuming you meant 50% (.5), rather than 5000%.
:shock: yes, lol...))

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Sugar_and_rice