In this video I’ll show you how to use the KivyMD MDDataTable for Kivy and Python.

Tables with Kivy are a little tricky, but they don’t have to be. In this video I’ll walk you through it step by step.

Usually we use a .kv file to style our app, but in this video we’ll just use a python file to create our DataTable.

#kivy #codemy

Python Code:
GitHub Code:

from kivy.lang import Builder
from import MDApp
from kivymd.uix.screen import Screen
from kivymd.uix.datatables import MDDataTable
from kivy.metrics import dp
# Display Pixles

class MainApp(MDApp):
	def build(self):
		# Define Screen
		screen = Screen()
		# Define Table
		table = MDDataTable(
			pos_hint = {'center_x': 0.5, 'center_y': 0.5},
			size_hint =(0.9, 0.6),
			check = True,
			column_data = [
				("First Name", dp(30)),
				("Last Name", dp(30)),
				("Email Address", dp(30)),
				("Phone Number", dp(30))
			row_data = [
				("John", "Elder", "[email protected]", "(123) 456-7891"),
				("Mary", "Elder", "[email protected]", "(123) 456-1123"),


		# Bind the table

		self.theme_cls.theme_style = "Light"
		self.theme_cls.primary_palette = "BlueGray"
		#return Builder.load_file('table.kv')
		# Add table widget to screen
		return screen
	# Function for check presses
	def checked(self, instance_table, current_row):
		print(instance_table, current_row)
	# Function for row presses
	def row_checked(self, instance_table, instance_row):
		print(instance_table, instance_row)


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

1 comment

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

John Elder