Kivy Crash Course – Kivy Design Language Introduction

This is our second article on Kivy Crash Course, in this article we are going to talk about Kivy Design Language Introduction. Kivy provides a design language specifically geared towards easy and scalable GUI Design. The language makes it simple to separate the interface design from the application logic, also it is called KVlang.  It has very clean syntax and makes Kivy interface design much more enjoyable than any other toolkit.

 

 

 

Also you can watch the video for this article

 

 

 

 

Kivy Crash Course Articles

1: Kivy Crash Course Introduction & Installation

 

 

 

So first of all you need to create a new file where you have your python code, iam going to to call it window.kv. Your .kv file should always have the same name as your app class. it is one of the important point that will be confusing for those who are new with kivy. but make sure when you create your .kv file, it should be the same as your main app class.  for example i have called my python app class Window, now i need to create a .kv file at name of window.kv, the same as my app class.

 

This is a very simple KV language file that creates a new Label object and sets its text to the Hello Kivy Application string. If you now run the code , you will see the window pop up, still with a black background, but also with the text displayed in its center.

 

 

 

So now this is our python file i have called it main4.py.

 

You can see in the above code, in the build method we have just returned our label class.

 

 

 

 

 

So now run the code and this will be the result

Kivy Crash Course - Kivy Design Language Introduction
Kivy Crash Course – Kivy Design Language Introduction

 

 

 

 

 

Subscribe and Get Free Video Courses & Articles in your Email

 

Codeloop
Share via
Copy link
Powered by Social Snap
×