sia
sia

Reputation: 411

how can i set kivy widgets position platform independently?

I'm writing an application with kivy that scans a network and based on results it generates bunch of widget like labels and buttons or maybe a layout like Gridview.

I'm trying to position them by pos or center_x and center_y attributes. I can position them perfectly on my laptop but when I try my tablet or other devices with different screen sizes everything goes wrong and all widgets change their position.

My question is:
Is there a elegant way to position widgets and layouts that pertain their position on any screen size?

P.S:

it's not working even when i maximize the window.

Upvotes: 0

Views: 719

Answers (1)

qua-non
qua-non

Reputation: 4172

You have many different options here like::

  1. Query the Window size and position your widget relative to the window using percentages instead of absulute values.
  2. Use specific layout that fits the positioning style you need for you widgets.

Recomended

  1. Use pos_hint in combination with your layouts
  2. specify the widget pos using kivy.metrics.dp which gives you device independent pixels or use metrics.sp/cm/mm/in/...

Upvotes: 2

Related Questions