Ren'Py the position of imagebutton

QQ

Newbie
May 14, 2017
89
54
as the cod i have see about imagebutton used on inventory and other use xpos ypos to locate the button. so how do i know the number of the xpos ypos for the place i want to put?
 

Porcus Dev

Engaged Member
Game Developer
Oct 12, 2017
2,582
4,689
You have to take into account the pixels in your image. The upper left corner will have values of 0.0 (xpos 0 ypos 0); if you are using 1920x1080 images, the lower right corner will have a value of 1920.1080 (xpos 1920 ypos 1080).

You can also use xalign or yalign, where 0.0 (xalign 0 yalign 0) is the upper left corner, and 1.1 (xalign 1 yalign 1) is the lower right corner; then xalign 0.5 yalign 0.5 will be the center.





Also keep in mind that those positions are relative to where you are using them (full screen, grid, frame, etc).
 

the66

beware, the germans are cumming
Modder
Donor
Respected User
Jan 27, 2017
7,655
23,746
and keep in mind, an integer as argument is always an absolute positional data, a float is a relative position ranging from 0.0 (top or left side of the parent displayable) to 1.0 (bottom or right side).
negative numbers or numbers, greater than the max. size of the parent displayable, are possible and place the object outside the boundaries of the parent displayable.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,171
  • shift + D to open the developer menu ;
  • Choose "Image Location Picker" ;
  • Select the image that will be the background for the image button ;
  • If you're on Windows, Windows Key + + (repeat if needed) ;
  • place the cursor where the image button must be put ;
  • Windows Key + - (repeat if needed) ;
  • Look at the coordinates of the mouse and use them to place the imagebutton.
 
  • Like
Reactions: Grap