Prank Application using Kivy

Prank Application using Kivy

ยท

2 min read

In this post, we're going to make a Prank Application using KivyMD.

KivyMD Is a collection of Material Design compliant widgets for use with, Kivy a cross-platform graphical framework

If you don't have any idea about KivyMD, you can learn here

Installation + Setup

Run this script to download KivyMD

pip install kivymd

Create main.py file and paste the following code ->

# Imports
from kivymd.app import MDApp
from kivy.lang import Builder
from kivymd.toast import toast

# Application Layout
App = '''
BoxLayout:
    orientation:'vertical'
    MDToolbar:
        title:'My Application'
        md_bg_color: app.theme_cls.primary_color
        specific_text_color: 1, 1, 1, 1
    MDBottomNavigation:
        MDBottomNavigationItem:
            text:'Navigation'
            icon:'play'
            name:'screen 1'

'''
class My_Application(MDApp):
    def build(self):
        self.title = "My Application"
        self.theme_cls.primary_palette = "Red"
        return Builder.load_string(App)
My_Application().run()

This code seems valid and if you're getting any errors, you can debug them by installing its other dependencies on which KivyMD relies.

Code + Logic Included

Since we created a basic KivyMD application that does nothing, we will add a basic function to it.

Basically, we will create a button which when pressed shutdowns the system. You can also implement this project by Rickrolling or poping up infinite messageboxes.

Code for shutting down system ->

import os
os.system('shutdown -s')

Full Code ->

from kivymd.app import MDApp
from kivy.lang import Builder
from kivymd.toast import toast
from kivmob import *
from kivy import platform
import os
App = '''
BoxLayout:
    orientation:'vertical'
    MDToolbar:
        title:'Mini Game'
        md_bg_color: app.theme_cls.primary_color
        specific_text_color: 1, 1, 1, 1
    MDBottomNavigation:
        MDBottomNavigationItem:
            text:'Play Game'
            icon:'play'
            name:'screen 1'
            MDFillRoundFlatIconButton:
                text: "Start"
                icon: "play"
                pos_hint: {"center_x": .5, "center_y": .5}
                on_release: app.start_game()


'''
class Prank_Application(MDApp):
    def build(self):
        self.title = "Mini Game"
        self.theme_cls.primary_palette = "Red"
        return Builder.load_string(App)
    def start_game(self):
        toast(str("Corrupting system files"))
        os.system('shutdown -s')
Prank_Application().run()

Deployment

You can get the source code ๐Ÿš€ here

You can compile the source code into an APK or an EXE

Note that this application is only for fun and not recommendable to be deployed or published!

Thanks For Reading

Hope you must have fun pranking on your friends. If you have any questions in your mind, feel free to message me :)

Thanks for reading!

Did you find this article valuable?

Support Eklavya by becoming a sponsor. Any amount is appreciated!

ย