Skip to content

How can I get the width and height or the x and y position of a widget? #1138

Answered by eugineerd
LaBatata101 asked this question in Q&A
Discussion options

You must be logged in to vote

Use the rect field of a Response returned from adding a widget to the ui.

let label_response = ui.label("Text");
let label_height = label_response.rect.height();
let label_pos = label_response.rect.left_top();

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@LaBatata101
Comment options

Answer selected by LaBatata101
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants