In this Python and Kivy article we want to learn about Introduction to Python and Kivy, so first of all let’s talk about Python, so Python is powerful and popular programming language that is used for different types of applications including web development, data analysis and scientific computing. Kivy is free and open source Python framework for creating cross platform user interfaces that can run on desktop computers, mobile devices and even embedded systems. in this article we want to introduce you Python and Kivy, and shows you how to get started with building your own cross platform apps.
What is Python Kivy ?
Kivy is Python framework for building multi touch applications. it is designed to be cross platform, which means that you can develop your applications that you can deploy it on multiple platforms such as Windows, Mac, Linux, Android and iOS. Kivy uses declarative language for designing UIs, and that is called KV language. KV language is similar to JSON and allows you to define the structure and layout of your UI in clear and easy way.
First if all we nee to install Python Kivy and you can use pip command for that.
pip install kivy
this is an example of simple KV file that defines label and button, this KV file defines a Label widget with text Welcome to geekscoders.com, and a Button widget with text Click me. when you run this KV file using the Kivy framework, it will display a window with a label and a button, right now we are not going to talk about kv file.
text: "Welcome to geekscoders.com"
text: "Click me"
So this is an example of simple Python code that creates a Kivy window with label and button.
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
def __init__(self, **kwargs):
self.orientation = "vertical"
self.label = Label(text="Welcome to geekscoders.com")
self.button = Button(text="Click me!")
if __name__ == "__main__":
Run the complete code and this will be the result