size of imagebuttons

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
QuantumHive
Newbie
Posts: 12
Joined: Thu Nov 20, 2014 12:58 pm
Contact:

size of imagebuttons

#1 Post by QuantumHive »

I can do this

Code: Select all

foo = ui.text(...)
foo_size = foo.size() #gives me a typle of the width and height
but I can't do this

Code: Select all

foo = ui.imagebutton(...)
foo_size = foo.size() #gives me an error that object has no attribute size
I'm pretty annoyed that such a simple thing is hard to do. I even tried things like

Code: Select all

foo = ui.imagebutton(...)
foo.style.xsize #not readable
foo.style.xmaximum #not readable..
#etc.
In most languages, you have getters and setters, why is it so hard to achieve this in renpy?
Also I can't seem to find any documentation, I've searched for 1 hour and no results..

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

Re: size of imagebuttons

#2 Post by xavimat »

Do you have a specific reason to use ui. instead of screen language? (IMO, it's easier to use screen language).
My answer uses screen language, I'm not sure about ui.:

"Size" is one of the "Text Style Properties" (http://renpy.org/doc/html/style_propert ... perty-size)
You can learn all the properties of "imagebutton" here: http://renpy.org/doc/html/screens.html#imagebutton

Doc:
http://renpy.org/doc/html/screen_python ... -functions
http://renpy.org/doc/html/screens.html
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
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: size of imagebuttons

#3 Post by xela »

xavimat wrote:Do you have a specific reason to use ui. instead of screen language? (IMO, it's easier to use screen language).
QFT :)
QuantumHive wrote:...
How about:

Code: Select all

foo = ui.imagebutton(...)
foo_size = foo.window_size
?
Like what we're doing? Support us at:
Image

Post Reply

Who is online

Users browsing this forum: DewyNebula