Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 [Kivy] Weird spacing in grid layout
#1
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 gl
But, when i run it, i am getting a space between the last two rows for some reason.
https://drive.google.com/open?id=1mx288A...O_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 tp
But it isnt showing any widgets inside.
Please advice :)
Quote
#2
Hi,
Did you managed to fix it?
Quote
#3
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?
silly American kah-nig-hit
Quote
#4
The code is not complete.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Spacing Between two labels are very far and Top label is not in Center using Tkinter barry76 2 247 Jul-30-2019, 10:49 AM
Last Post: wuf
  [Tkinter] Problems with frames layout Gupi 1 281 May-27-2019, 09:41 AM
Last Post: Yoriz
  Python GUI layout off between different OS shift838 5 664 Jan-02-2019, 02:53 AM
Last Post: shift838
  [PyQt] Layout unwanted space WatcherMagic 2 520 Dec-12-2018, 09:37 PM
Last Post: WatcherMagic
  [Tkinter] tkiner spacing on a canvas help Chuy 1 835 Jul-21-2018, 08:02 PM
Last Post: Chuy
  [Tkinter] grid layout neech 8 8,281 Oct-14-2016, 07:06 PM
Last Post: Larz60+

Forum Jump:


Users browsing this thread: 1 Guest(s)