Kivy is a platform-independent GUI tool in Python. It can run on Android, IOS, Linux and Windows, etc. This is the only GUI library from python which can independently run on the android device even we can use it on Raspberry Pi also. If you are new to kivy you can learn from this link.
In this article, we will develop a GUI window using kivy framework of Python, and we will add a button on this window. Usually what happens is we attach a method to a button and the whole method is defined in another python file but this time we will write the button code of python in the same kivy string.
Note: We are using the on_release event here with the button to make it functional. We can also use the on_press event also rather than the on_release event, both events can open the link, the only difference is on_release event will open the link when we release our finger from the button while on_press will open the link as soon as we touch the button. For using on_press event simply replace on_release with on_press.
Here, the IDE we are going to use is pycharm and the version of python we are going to use is python 3.6.
Implementation
Python3
from kivy.uix.button import Button
from kivy.app import App
from kivy.lang import Builder
class uiApp(App):
def build( self ):
return Builder.load_string(
)
uiApp().run()
|
Output:
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
25 Feb, 2021
Like Article
Save Article