In this video I’ll show you how to use the FloatLayout with Kivy to position the things in your app.

Float Layout allows you to position things very precisely on your app. We do that using size_hint (which takes a width and height argument) and pos_hint (which is a dictionary that can take 6 arguments – x, y, top, bottom, left, and right).

With the float layout, you can move things around your app, or float them around your app any way you like!

Python Code:
GitHub Code:

from import App
from kivy.uix.widget import Widget
from import ObjectProperty
from kivy.lang import Builder
from kivy.core.window import Window
#from kivy.uix.floatlayout import FloatLayout

# Designate Our .kv design file 

class MyLayout(Widget):

class AwesomeApp(App):
	def build(self):
		Window.clearcolor = (1,1,1,1)
		return MyLayout()

if __name__ == '__main__':

Kivy Design Code: float_layout.kv
GitHub Code: float_layout.kv

	font_size: 32
	size_hint: (0.3, 0.3)

		size: root.width, root.height
			text: "Top Left"
			# {"x", "y", "top", "bottom", "left", "right"}
			pos_hint: {"x":0, "top":1}
			text: "Top Right"
			pos_hint: {"x":.7, "top":1}
			text: "Center"
			pos_hint: {"x":0.35, "top":0.66}

			text: "Bottom Left"
			pos_hint: {"x":0}

			text: "Bottom Right"
			pos_hint: {"x":.7, "bottom":1}

John Elder

John is the CEO of where he teaches over 100,000 students how to code! He founded one of the Internet's earliest advertising networks and sold it to a publicly company at the height of the first dot com boom. After that he developed the award-winning Submission-Spider search engine submission software that's been used by over 3 million individuals, businesses, and governments in over 42 countries. He's written several Amazon #1 best selling books on coding, and runs a popular Youtube coding channel.

View all posts

Add comment

Your email address will not be published. Required fields are marked *

John Elder