Python Kivy മലയാളം #ഷോർട്സ

Posted by


Python Kivy is a powerful open-source Python library for developing multi-platform applications with a natural user interface (NUI) and a modern and innovative look and feel. In this tutorial, we will learn how to create a simple app using Python Kivy in Malayalam language.

  1. Setting up the environment:
    Before we start working on our Kivy app, we need to make sure that we have the necessary tools and libraries installed on our system. To install Python Kivy, open your terminal and run the following command:
pip install kivy

You may also need to install some additional dependencies depending on your operating system. You can find more information on the Kivy website.

  1. Creating a basic Kivy app:
    Now, let’s create a simple Kivy app in Malayalam language. Create a new Python file and add the following code:
from kivy.app import App
from kivy.uix.label import Label

class MalayalamApp(App):
    def build(self):
        return Label(text='ഹലോ ലോകം!')

if __name__ == '__main__':
    MalayalamApp().run()

In this code snippet, we import the necessary Kivy modules, create a new class called MalayalamApp that extends App, and define the build method that returns a Label widget with the Malayalam text "ഹലോ ലോകം!".

  1. Running the app:
    To run our Kivy app, save the Python file and execute it in your terminal by running the command python filename.py. You should see a window pop up with the Malayalam text displayed in the center.

  2. Adding interactivity:
    Let’s make our app a bit more interactive by adding a button that changes the text when clicked. Update your Python file with the following code:
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.button import Button

class MalayalamApp(App):
    def build(self):
        self.label = Label(text='ഹലോ ലോകം!')
        self.button = Button(text='Click ചെയ്യൂ!')
        self.button.bind(on_press=self.on_button_click)

        return self.label

    def on_button_click(self, instance):
        self.label.text = 'നമസ്കാരം ലോകം!'

if __name__ == '__main__':
    MalayalamApp().run()

In this updated code, we create a Button widget with the text "Click ചെയ്യൂ!" and bind it to the on_button_click method. When the button is clicked, the text of the label changes to "നമസ്കാരം ലോകം!".

  1. Customizing the app:
    You can further customize your Kivy app by changing the fonts, colors, sizes, and layouts of the widgets. Refer to the Kivy documentation for more advanced customization options.

That’s it! You have successfully created a simple Kivy app in Malayalam language. Feel free to explore more features and functionalities of Kivy to build more complex and interactive applications. Happy coding!

0 0 votes
Article Rating
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@mylove-kv8if
2 months ago

👍