[Kivy] Weird spacing in grid layout - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Kivy] Weird spacing in grid layout (/thread-19314.html) |
Weird spacing in grid layout - test - Jun-22-2019 Hello! I am trying to make a form using kivy. Here is what i tried. class MyMainApp(App): def build(self): x = 0.3 x1 = 0.6 y = 40 lab0 = custLabel(text='Date: ') datee = DatePicker(size_hint=(x1, None), height=y) lab1 = custLabel(text='Patient ID: ') ID = custTextInput() lab2 = custLabel(text='Name: ') namee = custTextInput() lab3 = custLabel(text='Age: ') Age = custTextInput() lab4 = custLabel(text='Informant: ') informant = custTextInput() spin = Spinner(text='Parent', size_hint=(x, None), height=y, values=['Parent', 'Grand parent', 'Spouse', 'Neighbour', 'Friend', 'Other relative']) #informant relation and name box = BoxLayout(orientation='horizontal', size_hint=(1,0.8)) box.add_widget(informant) box.add_widget(spin) gl = GridLayout(cols=2, size_hint=(0.9,0.8)) gl.add_widget(lab0) gl.add_widget(datee) gl.add_widget(lab1) gl.add_widget(ID) gl.add_widget(lab2) gl.add_widget(namee) gl.add_widget(lab3) gl.add_widget(Age) gl.add_widget(lab4) gl.add_widget(box) return glBut, when i run it, i am getting a space between the last two rows for some reason. https://drive.google.com/open?id=1mx288AuHkz1AZOMph6bK4TO_paK8HXW1 Can someone please tell me how i can get rid of it? Also, can i put this grid layout in a tabbed panel? (I tried to by doing this) tp = TabbedPanel() tp.content = gl return tpBut it isnt showing any widgets inside. Please advice :) RE: Weird spacing in grid layout - luke - Nov-08-2019 Hi, Did you managed to fix it? RE: Weird spacing in grid layout - Denni - Nov-08-2019 I do not use Kivy but when using the QGridLayout of Qt you need to supply the coordinates for the Widget you are adding .addWidget(self.MyWidget, row, col) but perhaps that is not the case with Kivy but if not how do you tell the Grid where to put the object you are adding?
RE: Weird spacing in grid layout - Axel_Erfurt - Nov-08-2019 The code is not complete. |