[Question] How to get position&size of image in screen?

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
Sirin
Regular
Posts: 39
Joined: Mon Jul 13, 2009 10:16 am
Contact:

[Question] How to get position&size of image in screen?

#1 Post by Sirin »

I've one question about "How to get position & size of image that show in the screen"

normally "renpy.get_image_bounds" can solve this problem if the image show in label block but not in screen.

Is there a way that can get position and size while that image show via screen language?


my code is something like this

Code: Select all

init:
    image dd = 'dd.jpg'

screen testing():
    
    add 'dd'

label start:

    show screen testing

    python:
        a = renpy.get_image_bounds('dd')

        #do something about size and position

    
"renpy.get_image_bounds" return None instead of tuple type data and I stuck in this point.

PS.umm....I think "AddToSet()" and "RemoveFromSet()" functions have a bug that alway show a error everytime I use them.

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

Re: [Question] How to get position&size of image in screen?

#2 Post by Alex »

Try to set the "layer" property to "screens" - https://www.renpy.org/doc/html/displayi ... age_bounds

Sirin
Regular
Posts: 39
Joined: Mon Jul 13, 2009 10:16 am
Contact:

Re: [Question] How to get position&size of image in screen?

#3 Post by Sirin »

Alex wrote:Try to set the "layer" property to "screens" - https://www.renpy.org/doc/html/displayi ... age_bounds
I tried and unfortunely that can't solve it "renpy.get_image_bounds" still return None no matter what...

henvu50
Veteran
Posts: 337
Joined: Wed Aug 22, 2018 1:22 am
Contact:

Re: [Question] How to get position&size of image in screen?

#4 Post by henvu50 »

Was this ever resolved? There's no proper documentation on how to get a displayable's xpos and ypos, where it is on the screen exactly.

Post Reply

Who is online

Users browsing this forum: Li yuanlin, Vamp-sama