You are on page 1of 3

Ex: No: 5 Name: VYSHNAVI MANTHENA

Date: 23/02/24 Reg no:21BEE0311

App creation using kivy library (Internal GUI)

Aim: To create an application with an internal GUI using the Kivy library,.

Description about the experiment:

This experiment involves the utilization of the Kivy library to develop a cross-platform mobile or
desktop application, emphasizing an internal graphical user interface (GUI). Kivy, distinguished for
its Python-based framework, facilitates the construction of user-friendly interfaces. The
procedural workflow encompasses meticulous planning, design, and subsequent implementation
phases. Leveraging Python within the Kivy framework, we define and instantiate interactive GUI
elements, such as buttons and sliders. Rigorous testing protocols are applied to ascertain
functional integrity across diverse platforms, with particular attention to addressing potential
compatibility issues. Iterative refinements driven by user feedback aim at optimizing user
satisfaction and interface performance. The experiment concludes with comprehensive
documentation, encapsulating key insights and outcomes, thereby contributing to the ongoing
exploration of Kivy's efficacy in the development of intuitive application interfaces.
Python code:
import kivy
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
from kivy.uix.image import Image
class childApp(GridLayout):
def __init__(self):
super(childApp, self).__init__()
self.cols=2
self.add_widget(Image(source="C:/Users/IOT/Pictures/child.jpg"))
self.add_widget(Image(source="C:/Users/IOT/Pictures/child.jpg"))
self.add_widget(Label(text="Student Name:"))
self.s_name=TextInput()
self.add_widget(self.s_name)
self.add_widget(Label(text="Reg No:"))
self.s_regno=TextInput()
self.add_widget(self.s_regno)
self.add_widget(Label(text="Department:"))
self.s_Dept=TextInput()
self.add_widget(self.s_Dept)
self.add_widget(Label(text="School:"))
self.s_schl=TextInput()
self.add_widget(self.s_schl)
self.add_widget(Label(text="Year of passing:"))
self.s_year=TextInput()
self.add_widget(self.s_year)
self.press=Button(text='Click')
self.press.bind(on_press=self.click)
self.add_widget(self.press)
def click(self,instance):
f =open("out1.txt",'a')
print("Student Name:" + self.s_name.text,file=f)
print("Reg No:" + self.s_regno.text,file=f)
print("Department:" + self.s_Dept.text,file=f)
print("School:" + self.s_schl.text,file=f)
print("Year of passing:" + self.s_year.text,file=f)
f.close()

class parentApp(App):
def build(self):
return childApp()
if __name__ == "__main__":
app=parentApp()
app.run()

Steps involved and output (snapshots)

• Open PyCharm and create a new Python project.

• Install the Kivy library using the terminal within PyCharm

• Create a Python file (e.g., main.py).

• Import the necessary Kivy modules

• Define a class inheriting from kivy.app and run the program.


Result and Inference
In this experiment, PyCharm and the Kivy library were successfully leveraged to create a functional
application displaying student details. This showcases Kivy's potential for crafting user interfaces
that effectively present information. Further development could introduce functionalities like user
input for adding or modifying student data, potentially leading to a valuable tool for student
record management.

You might also like