Align layout text to left inside a gridview

880 views
Skip to first unread message

Karam Jaber

unread,
Jul 31, 2018, 6:50:15 AM7/31/18
to Kivy users support
Hi,
I've created a Gridview that has 7 columns . Every column has a Gridview of 2 colm:
Every 2 Columns has 2 Layouts : The first is fixed layout, and the second is dynamic layout that can be changed during runtime.
I want to have them without any spacing between them.

Tried valign:"left" but that didn't appear to change anything.
This is how it look like :




But as you can see in the blue Grids there is a big space between them and i want to delete this space.

Any suggestion?

Karam Jaber

unread,
Jul 31, 2018, 6:55:02 AM7/31/18
to Kivy users support
Adding the .kv file :


 GridLayout:
canvas.before:
Color:
rgb:0.4,0.4,0.4
Rectangle:
pos: self.pos
size: self.size
size_hint: 1,.05
cols: 7
text_size: self.size
spacing: 10
padding: 10
GridLayout:
cols: 2
Label:
halign:"right"
valign:"center"
text:" System State:"
Label:
halign:"left"
valign:"center"
text:"N/A"
GridLayout:
cols: 2
Label:
halign:"right"
text:"Power State:"
Label:
halign:"left"
text:"N/A"
GridLayout:
cols: 2
Label:
text:"ME Status:"
Label:
halign:"left"
text:"N/A"
GridLayout:
cols: 2
Label:
text:"PG State:"
Label:
halign:"left"
text:"N/A"
GridLayout:
cols: 2
Label:
text:"Deep Sx:"
Label:
halign:"left"
text:"N/A"
GridLayout:
cols: 2
Label:
text:"S0ix State:"
Label:
halign:"left"
text:"N/A"
GridLayout:
cols: 2
Label:
text:"Post Code:"
Label:
halign:"left"
text:"N/A"

ZenCODE

unread,
Aug 1, 2018, 2:55:48 AM8/1/18
to Kivy users support
Label text does not always appear as you expect. See here: https://kivy.org/docs/api-kivy.uix.label.html

I would suggest drawing a border/background on the labels so you can differentiate between the label placement and the text placement/alignment.
Reply all
Reply to author
Forward
0 new messages