0% found this document useful (0 votes)
5 views35 pages

AndroidApp Development Project1

This document provides a comprehensive installation guide for Android app development using Python and Kivy, detailing the steps to install Anaconda, set up a virtual environment, and install necessary libraries. It includes instructions for integrating Anaconda with PyCharm and creating a simple Android app, along with a mini project for student registration that demonstrates various Kivy concepts. The document emphasizes the importance of using Anaconda, PyCharm, and Kivy for efficient app development.

Uploaded by

Ankita Ghosh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views35 pages

AndroidApp Development Project1

This document provides a comprehensive installation guide for Android app development using Python and Kivy, detailing the steps to install Anaconda, set up a virtual environment, and install necessary libraries. It includes instructions for integrating Anaconda with PyCharm and creating a simple Android app, along with a mini project for student registration that demonstrates various Kivy concepts. The document emphasizes the importance of using Anaconda, PyCharm, and Kivy for efficient app development.

Uploaded by

Ankita Ghosh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Techno India University

MCA 2A And 2B
Subject Code - TIU-PCA-L208
2nd year 4th semester
Project

Gopa Halder Biswas


Installation Guide for Android App Development
 Anaconda
 PyCharm
 Setting up Android App Development (Python + Kivy)

You can directly use this for your class.

Installation Guide for Android App Development

(Python + Kivy using Anaconda & PyCharm)

Install Anaconda

🔹 Step 1: Download Anaconda


1. Open browser
2. Search: Anaconda Download
3. Go to official website:
👉 Anaconda, Inc.
4. Select your Operating System (Windows/Mac/Linux)
5. Download Python 3.x version

🔹 Step 2: Install Anaconda (Windows)


1. Open downloaded .exe file
2. Click Next
3. Click I Agree
4. Select Just Me
5. Keep default location
6. Tick:
 ✅ Register Anaconda as default Python
7. Click Install
8. Click Finish

🔹 Step 3: Check Installation

Open:

Anaconda Prompt

Type:

conda --version

If version appears → Installation successful ✅


Create Android Development Environment

In Anaconda Prompt:

conda create -n android_env python=3.10

Press Y

Activate environment:

conda activate android_env

Now prompt will show:

(android_env)
Install Kivy

Inside activated environment:

pip install kivy

Test installation:

python >>> import kivy >>> kivy.__version__

If no error → Kivy installed successfully ✅

Install PyCharm

🔹 Step 1: Download PyCharm

Go to official website:
JetBrains

Download:

PyCharm

Choose:

 Community Version (Free)


🔹 Step 2: Install PyCharm
1. Open downloaded file
2. Click Next
3. Tick:
 ✅ Add to PATH
 ✅ Create Desktop Shortcut
4. Install
5. Finish
Connect Anaconda Environment with PyCharm

🔹 Step 1: Open PyCharm

Click:
New Project

Step 2: Choose Interpreter


1. Click Add Interpreter
2. Select Conda Environment
3. Choose:
 Existing Environment
4. Browse and select:
Anaconda3/envs/android_env/[Link]
5. Click OK

Now PyCharm is connected to Anaconda environment ✅

Test First Android App in PyCharm

Create new file: [Link]

Write:

from [Link] import App from [Link] import Label


class MyFirstApp(App): def build(self): return
Label(text="Android App Development Started")
MyFirstApp().run()

7 Important Note for Students

✔ Anaconda → Manages Python


✔ PyCharm → IDE (Code Editor)
✔ Kivy → App Development Framework
✔ Buildozer → Required later for APK generation (Linux recommended)
Complete Installation Flow
Install Anaconda

Create Environment

Activate Environment

Install Kivy

Install PyCharm

Connect Interpreter

Step 1: Download Anaconda (64-bit for Windows 11)

1. Open browser
2. Go to official website:
👉 [Link]
3. Click Download
4. Choose:
o ✅ Windows
o ✅ 64-Bit Installer
o ✅ Python 3.x version

Download the .exe file.

✅ Step 2: Install Anaconda

1. Double-click the downloaded .exe


2. Click Next
3. Select Just Me (Recommended)
4. Choose installation location (default is fine)
5. ✔️ Tick: “Register Anaconda as my default Python” (recommended)
6. Click Install
7. Click Finish
Step 3: Verify Installation

Open:

 Start Menu → Anaconda Prompt

Type:

conda --version
python --version

If version appears → ✅ Installation successful

Step 4: Create Virtual Environment for Android Development

In Anaconda Prompt:

conda create -n android_env python=3.10

Activate environment:

conda activate android_env

Step 5: Install Required Libraries for Android App Development


Option 1: Using Kivy (Most Popular for Python Android Apps)

Install Kivy:

pip install kivy

Check installation:

python -m kivy

Option 2: Using BeeWare (Alternative)


pip install briefcase

Step 6: Install Android Studio (Required for APK Building)

Download and install:

👉 [Link]

After installing:

 Install SDK
 Install Android Emulator
 Configure environment variables

Step 7: For APK Generation (Advanced)

For building APK files, you need:

 WSL (Windows Subsystem for Linux)


 Ubuntu
 Buildozer

Because Buildozer works best in Linux environment.

Install WSL:

Open PowerShell as Administrator:

wsl --install

️ Recommended Setup for Teaching Students (Simple Way)

If you are preparing MCA syllabus:

✔️ Use:

 Anaconda
 Python
 Kivy
 VS Code

Later add:

 Android Studio
 WSL + Buildozer

Basic Example: Simple Android App Using Kivy


from [Link] import App
from [Link] import Label

class MyApp(App):
def build(self):
return Label(text="Hello Android App")

MyApp().run()

Run:

python [Link]
Create a Student Registration & Preferences mini project that integrates many
key Kivy concepts covered in the PDF:

 App class
 Widgets (Label, Button, TextInput, CheckBox, Slider, ProgressBar, Switch,
Image)
 Layouts (BoxLayout)
 Event handling (bind)
 Dynamic UI updates (progress bar updates based on input)

The app collects user details, shows a profile image placeholder, lets the user
set preferences (notifications, age), and validates acceptance of terms. A
progress bar shows how complete the form is, and a submit button displays a
summary message.

Mini Project: Student Registration & Preferences (Kivy)

# student_registration.py
# A Kivy app demonstrating multiple widgets and dynamic updates.

from [Link] import App


from [Link] import BoxLayout
from [Link] import Label
from [Link] import TextInput
from [Link] import Button
from [Link] import Image
from [Link] import CheckBox
from [Link] import Slider
from [Link] import Switch
from [Link] import ProgressBar
from [Link] import Clock
from [Link] import Color, Rectangle
from [Link] import Window

# Set a nice background color (optional)


[Link] = (0.95, 0.95, 0.95, 1)

class RegistrationApp(App):
def build(self):
# Main vertical layout
main_layout = BoxLayout(orientation='vertical', padding=20,
spacing=10)

# --- Header (Image + Title) ---


header = BoxLayout(size_hint=(1, 0.2))
# Placeholder image – replace "[Link]" with your own im
age
# To avoid missing file errors, we use a colored rectangle i
f no image exists.
# For simplicity, we'll create a colored widget using a Labe
l with background.
# But to demonstrate Image widget, we include a dummy image.
(You can remove it.)
# Here we use a Label with text "📸" as a placeholder.
self.profile_image = Label(text="📸", font_size=50, size_hin
t=(0.2, 1))
self.title_label = Label(text="Student Registration", font_s
ize=28, bold=True, size_hint=(0.8, 1))
header.add_widget(self.profile_image)
header.add_widget(self.title_label)
main_layout.add_widget(header)

# --- Form fields ---


# Name
row_name = BoxLayout(size_hint=(1, 0.1))
row_name.add_widget(Label(text="Name:", size_hint=(0.3, 1)))
self.name_input = TextInput(hint_text="Enter your full name"
, multiline=False)
row_name.add_widget(self.name_input)
main_layout.add_widget(row_name)

# Email
row_email = BoxLayout(size_hint=(1, 0.1))
row_email.add_widget(Label(text="Email:", size_hint=(0.3, 1)
))
self.email_input = TextInput(hint_text="student@[Link]"
, multiline=False)
row_email.add_widget(self.email_input)
main_layout.add_widget(row_email)

# Age Slider with value display


row_age = BoxLayout(size_hint=(1, 0.1))
row_age.add_widget(Label(text="Age:", size_hint=(0.3, 1)))
self.age_slider = Slider(min=1, max=100, value=18, step=1)
self.age_label = Label(text="18", size_hint=(0.2, 1))
row_age.add_widget(self.age_slider)
row_age.add_widget(self.age_label)
main_layout.add_widget(row_age)

# Notifications Switch
row_notify = BoxLayout(size_hint=(1, 0.1))
row_notify.add_widget(Label(text="Notifications:", size_hint
=(0.5, 1)))
self.notify_switch = Switch(active=True)
row_notify.add_widget(self.notify_switch)
main_layout.add_widget(row_notify)

# Terms CheckBox
row_terms = BoxLayout(size_hint=(1, 0.1))
self.terms_check = CheckBox(active=False)
row_terms.add_widget(self.terms_check)
row_terms.add_widget(Label(text="I accept the Terms and Cond
itions", size_hint=(0.8, 1)))
main_layout.add_widget(row_terms)

# Progress Bar (completion)


row_progress = BoxLayout(size_hint=(1, 0.1))
row_progress.add_widget(Label(text="Profile Completion:", si
ze_hint=(0.4, 1)))
[Link] = ProgressBar(max=100, value=0)
row_progress.add_widget([Link])
main_layout.add_widget(row_progress)

# Submit Button
self.submit_btn = Button(text="Register", size_hint=(1, 0.1)
, background_color=(0.2, 0.6, 0.8, 1))
self.submit_btn.bind(on_press=self.submit_form)
main_layout.add_widget(self.submit_btn)

# Message area
self.message_label = Label(text="", color=(0,0,0,1), size_hi
nt=(1, 0.1))
main_layout.add_widget(self.message_label)

# Bind events for dynamic progress update


self.name_input.bind(text=self.update_progress)
self.email_input.bind(text=self.update_progress)
self.age_slider.bind(value=self.on_age_change)
self.terms_check.bind(active=self.update_progress)

# Initial progress update


self.update_progress()

return main_layout

def on_age_change(self, instance, value):


"""Update the age label when slider moves."""
self.age_label.text = str(int(value))
self.update_progress()

def update_progress(self, *args):


"""Calculate how many fields are filled and update progress
bar."""
filled = 0
total = 4 # name, email, age (always considered filled beca
use slider has default), terms

if self.name_input.[Link]():
filled += 1
if self.email_input.[Link]():
filled += 1
# Age is always filled because slider has default value, but
we can treat as filled always
filled += 1
if self.terms_check.active:
filled += 1
progress_value = (filled / total) * 100
[Link] = progress_value

def submit_form(self, instance):


"""Handle registration submission."""
if not self.terms_check.active:
self.message_label.text = "❌ You must accept the Terms
and Conditions!"
return

# Gather data
name = self.name_input.[Link]() or "Not provided"
email = self.email_input.[Link]() or "Not provided"
age = self.age_label.text
notifications = "ON" if self.notify_switch.active else "OFF"

# Display summary
summary = f"✅ Registration submitted!\n\nName: {name}\nEmai
l: {email}\nAge: {age}\nNotifications: {notifications}"
self.message_label.text = summary

# Optional: disable the submit button after first submission


to prevent multiple submits
self.submit_btn.disabled = True
self.submit_btn.text = "Registered"

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

How to Run the Project

1. Install Kivy if not already done:

bash

pip install kivy

2. Save the code as student_registration.py.


3. Run it:
bash

python student_registration.py

4. A window will appear with the interactive form.

Expected Output / Screenshot Description

When you run the app, you'll see a clean window with:

 Header – a placeholder image icon (📸) and the title “Student Registration”.
 Form fields (each on its own row):

o Name: text input box with hint “Enter your full name”.
o Email: text input box with hint “student@[Link]”.
o Age: a horizontal slider from 1 to 100 with a label showing the current value.
o Notifications: a switch (ON/OFF), initially ON.
o Terms: a checkbox with the text “I accept the Terms and Conditions”.
 Profile Completion – a progress bar that updates automatically as you fill fields.

o It counts name, email, age (always 1 because slider has default), and accepted
terms.
o As you type or check terms, the progress bar fills accordingly.
 Register button – initially enabled.
 Message area – initially empty.

Interactive behaviour:

 Typing in the name or email increases the progress bar.


 Moving the slider updates the age label and also increases progress (age is
always considered filled).
 Checking the terms checkbox adds to progress.
 Clicking Register without terms checked shows an error message.
 With terms accepted, clicking Register shows a summary of entered data and
disables the button.
Concepts Demonstrated

Concept Implementation
App class RegistrationApp inherits from App
build() Creates the UI hierarchy
method
Widgets Label, TextInput, Slider, Switch, CheckBox, ProgressBar, Button, Image (via
placeholder)
Layouts BoxLayout (nested) for rows and main screen
Event bind for text changes, slider movement, checkbox toggle, button press
handling
Dynamic Progress bar recomputed on any input change
updates
Conditional Validation of terms, dynamic messages
logic

Mini Project: Student Profile Setup (Kivy)

# student_profile_setup.py
# A Kivy app that demonstrates multiple widgets and dynamic behavior
.

from [Link] import App


from [Link] import BoxLayout
from [Link] import Label
from [Link] import TextInput
from [Link] import Button
from [Link] import Image
from [Link] import CheckBox
from [Link] import Slider
from [Link] import Switch
from [Link] import ProgressBar
from [Link] import Window

# Optional: set a background color


[Link] = (0.95, 0.95, 0.95, 1)

class StudentProfileApp(App):
def build(self):
# Main vertical layout
main_layout = BoxLayout(orientation='vertical', padding=20,
spacing=10)

# ---- Header with Image (placeholder) and Title ----


header = BoxLayout(size_hint=(1, 0.15))
# Use a simple Label with an icon as image placeholder
# (Replace with actual image file if you have one)
self.profile_image = Label(text="📸", font_size=50, size_hin
t=(0.2, 1))
title = Label(text="Student Profile Setup", font_size=24, bo
ld=True, size_hint=(0.8, 1))
header.add_widget(self.profile_image)
header.add_widget(title)
main_layout.add_widget(header)

# ---- Name Input ----


name_box = BoxLayout(size_hint=(1, 0.1))
name_box.add_widget(Label(text="Name:", size_hint=(0.3, 1)))
self.name_input = TextInput(hint_text="Enter full name", mul
tiline=False)
name_box.add_widget(self.name_input)
main_layout.add_widget(name_box)

# ---- Email Input ----


email_box = BoxLayout(size_hint=(1, 0.1))
email_box.add_widget(Label(text="Email:", size_hint=(0.3, 1)
))
self.email_input = TextInput(hint_text="student@[Link]"
, multiline=False)
email_box.add_widget(self.email_input)
main_layout.add_widget(email_box)

# ---- Age Slider with value label ----


age_box = BoxLayout(size_hint=(1, 0.1))
age_box.add_widget(Label(text="Age:", size_hint=(0.3, 1)))
self.age_slider = Slider(min=1, max=100, value=18, step=1)
self.age_label = Label(text="18", size_hint=(0.2, 1))
self.age_slider.bind(value=self.on_age_change)
age_box.add_widget(self.age_slider)
age_box.add_widget(self.age_label)
main_layout.add_widget(age_box)

# ---- Notifications Switch ----


notify_box = BoxLayout(size_hint=(1, 0.1))
notify_box.add_widget(Label(text="Enable Notifications:", si
ze_hint=(0.6, 1)))
self.notify_switch = Switch(active=True)
notify_box.add_widget(self.notify_switch)
main_layout.add_widget(notify_box)

# ---- Interests (CheckBoxes) ----


interests_label = Label(text="Interests:", size_hint=(1, 0.0
5), halign='left')
main_layout.add_widget(interests_label)

interests_layout = BoxLayout(orientation='horizontal', size_


hint=(1, 0.1))
self.cb_python = CheckBox(active=False)
interests_layout.add_widget(self.cb_python)
interests_layout.add_widget(Label(text="Python"))
self.cb_java = CheckBox(active=False)
interests_layout.add_widget(self.cb_java)
interests_layout.add_widget(Label(text="Java"))
self.cb_ai = CheckBox(active=False)
interests_layout.add_widget(self.cb_ai)
interests_layout.add_widget(Label(text="AI/ML"))
main_layout.add_widget(interests_layout)

# ---- Terms and Conditions CheckBox ----


terms_box = BoxLayout(size_hint=(1, 0.1))
self.terms_check = CheckBox(active=False)
terms_box.add_widget(self.terms_check)
terms_box.add_widget(Label(text="I accept the Terms and Cond
itions", size_hint=(0.8, 1)))
main_layout.add_widget(terms_box)
# ---- Profile Completion Progress Bar ----
progress_box = BoxLayout(size_hint=(1, 0.1))
progress_box.add_widget(Label(text="Profile Completion:", si
ze_hint=(0.4, 1)))
[Link] = ProgressBar(max=100, value=0)
progress_box.add_widget([Link])
main_layout.add_widget(progress_box)

# ---- Submit Button ----


self.submit_btn = Button(text="Submit Profile", size_hint=(1
, 0.1), background_color=(0.2, 0.6, 0.8, 1))
self.submit_btn.bind(on_press=self.submit_profile)
main_layout.add_widget(self.submit_btn)

# ---- Message Area ----


self.message_label = Label(text="", color=(0, 0, 0, 1), size
_hint=(1, 0.1))
main_layout.add_widget(self.message_label)

# Bind events to update progress bar dynamically


self.name_input.bind(text=self.update_progress)
self.email_input.bind(text=self.update_progress)
self.terms_check.bind(active=self.update_progress)
# Also update when any interest checkbox changes
self.cb_python.bind(active=self.update_progress)
self.cb_java.bind(active=self.update_progress)
self.cb_ai.bind(active=self.update_progress)

# Initial progress update


self.update_progress()

return main_layout

def on_age_change(self, instance, value):


"""Update age label when slider moves."""
self.age_label.text = str(int(value))
self.update_progress()

def update_progress(self, *args):


"""Calculate completion percentage and update progress bar."
""
filled = 0
total = 5 # name, email, age, terms, at least one interest

if self.name_input.[Link]():
filled += 1
if self.email_input.[Link]():
filled += 1
# Age always considered filled because slider has a default
filled += 1
if self.terms_check.active:
filled += 1
if self.cb_python.active or self.cb_java.active or self.cb_a
[Link]:
filled += 1

percent = (filled / total) * 100


[Link] = percent

def submit_profile(self, instance):


"""Validate and display profile summary."""
if not self.terms_check.active:
self.message_label.text = "❌ Please accept the Terms an
d Conditions!"
return

name = self.name_input.[Link]() or "Not provided"


email = self.email_input.[Link]() or "Not provided"
age = self.age_label.text
notifications = "ON" if self.notify_switch.active else "OFF"

interests = []
if self.cb_python.active:
[Link]("Python")
if self.cb_java.active:
[Link]("Java")
if self.cb_ai.active:
[Link]("AI/ML")
interests_str = ", ".join(interests) if interests else "None
"

summary = (
f"✅ Profile Submitted!\n\n"
f"Name: {name}\n"
f"Email: {email}\n"
f"Age: {age}\n"
f"Notifications: {notifications}\n"
f"Interests: {interests_str}"
)
self.message_label.text = summary
# Disable submit button to avoid multiple submissions
self.submit_btn.disabled = True
self.submit_btn.text = "Submitted"

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

Expected Output & Behavior

When you run the code, a window appears with:

1. Header – a placeholder image (📸) and the title “Student Profile Setup”.
2. Form Fields:

o Name – text input with hint “Enter full name”.


o Email – text input with hint “student@[Link]”.
o Age – horizontal slider (1–100) with a label showing the current value.
o Notifications – a switch (ON/OFF), initially ON.
o Interests – three checkboxes (Python, Java, AI/ML).
o Terms – a checkbox for accepting terms.
3. Profile Completion – a progress bar that updates in real time as you fill the
fields.
4. Submit Profile button.
5. Message area – initially empty, shows error or success message.

Dynamic Behavior
 As you type in Name or Email, the progress bar increases.
 The Age slider’s value is always considered filled, so progress increases as soon
as you move it (or stays at that portion).
 Checking/unchecking the Terms checkbox updates progress.
 Selecting at least one interest also contributes to completion.
 Clicking Submit without accepting terms shows an error.
 With all required fields (name, email, age, terms, at least one interest) filled, the
progress bar reaches 100%.
 After a successful submit, a summary message appears, and the submit button
is disabled to prevent multiple submissions.

Example Output After Successful Submit

text
✅ Profile Submitted!

Name: John Doe


Email: john@[Link]
Age: 25
Notifications: ON
Interests: Python, AI/ML

� Concepts Demonstrated

Concept Implementation
App class & run() StudentProfileApp inherits from App
build() method Creates and returns the UI hierarchy
Widgets Label, TextInput, Slider, Switch, CheckBox, ProgressBar,
Button, Image (placeholder)
Layouts Nested BoxLayout for vertical/horizontal arrangement
Event handling .bind() for text changes, slider movement, checkbox
toggles, button press
Dynamic updates Progress bar recomputed on every input change
Input validation Terms check, empty fields check
State Disabling submit button after submission
management

This project is a great starting point for students to practice building a


complete interactive app with Kivy.

Detailed Explanation of Each Project

1. Student Registration & Preferences (First Code)

This app collects:

 Name, Email
 Age via slider
 Notifications switch
 Terms & Conditions checkbox

A progress bar shows how complete the form is, and a submit button displays a
summary.

Key Components

Compon Code Example Explanation


ent
App class RegistrationApp(App): Inherits
class from [Link]; the
main application
controller.
build() def build(self): Creates the UI and returns
method the root widget. Called
automatically by Kivy.
BoxLayo main_layout = Arranges child widgets
ut BoxLayout(orientation='vertical', vertically; padding adds
padding=20, spacing=10) space around edges,
spacing between children.
Label Label(text="Name:", Displays static
size_hint=(0.3, 1)) text. size_hint gives
relative width/height.
TextInp TextInput(hint_text="Enter your Input
ut full name", multiline=False) field. hint_text shows
placeholder; multiline=F
alse makes it single line.
Slider Slider(min=1, max=100, value=18, Allows selecting a number
step=1) from a
range. step defines
increments.
Switch Switch(active=True) On/off
toggle. active=True mea
ns ON.
CheckB CheckBox(active=False) Select/deselect
ox option. active controls
checked state.
Progres ProgressBar(max=100, value=0) Shows
sBar completion. value sets
current progress.
Button Button(text="Register", Clickable
on_press=self.submit_form) element. on_press binds
to a method.
Event self.name_input.bind(text=[Link] Calls update_progress wh
binding date_progress) enever the text changes.

Dynami def update_progress(self, *args): Recalculates completion


c percentage and
updates updates [Link].v
alue.
Validati if not self.terms_check.active: Checks if terms checkbox
on is ticked before
submission.
Output self.message_label.text = summary Displays a summary (or
error) in a Label.

Dynamic Progress Calculation

python
def update_progress(self, *args):
filled = 0
total = 4 # name, email, age (always filled), terms
if self.name_input.[Link]():
filled += 1
if self.email_input.[Link]():
filled += 1
filled += 1 # age always counts as filled because slider has de
fault
if self.terms_check.active:
filled += 1
[Link] = (filled / total) * 100

 Every time the user types in name/email or toggles the checkbox, this function
runs.
 The progress bar updates immediately, giving visual feedback.
✅ Submission Handling

python
def submit_form(self, instance):
if not self.terms_check.active:
self.message_label.text = "❌ You must accept the Terms and
Conditions!"
return
# Gather data and display summary
summary = f"✅ Registration submitted!\n\nName: {name}\nEmail: {
email}\nAge: {age}\nNotifications: {notifications}"
self.message_label.text = summary
self.submit_btn.disabled = True

 Validates the terms checkbox.


 Shows an error if not accepted, else shows a summary and disables the button.

2. Student Profile Setup (Second Code)

This app is an extension that adds:

 Interests checkboxes (Python, Java, AI/ML)


 More detailed progress calculation (includes interests)
 Age slider value displayed in a label (already present, but more explicit)
 Disabling submit after successful submission

The structure is similar, but with additional widgets and a slightly different
progress logic.

New/Improved Concepts

Concept Code Example Explanation

Horizonta interests_layout = Places


l BoxLayout(orientation='horizontal') checkboxes
BoxLayou side by side.
t for
interests

Multiple No group, so multiple can be selected. Each checkbox


CheckBox has a separate
es with variable
group (self.cb_pytho
n, etc.).
Progress if self.cb_python.active or At least one
includes self.cb_java.active or interest must
interests self.cb_ai.active: be selected for
100%
completion.
Age slider self.age_slider.bind(value=self.on_age_c Updates a
label hange) separate label
update to show the
current slider
value.
Clearer interests_str = ", ".join(interests) if Formats
output interests else "None" selected
summary interests as a
comma-separat
ed string.

Progress Calculation (with interests)

python
def update_progress(self, *args):
filled = 0
total = 5 # name, email, age, terms, at least one interest
if self.name_input.[Link]():
filled += 1
if self.email_input.[Link]():
filled += 1
filled += 1 # age always filled
if self.terms_check.active:
filled += 1
if self.cb_python.active or self.cb_java.active or self.cb_ai.ac
tive:
filled += 1
[Link] = (filled / total) * 100

 The total increased to 5 because we now require at least one interest.


 The user can select multiple interests, but only one is needed for completion.

Image Placeholder

python
self.profile_image = Label(text="📸", font_size=50, size_hint=(0.2,
1))

 In the absence of an actual image file, a label with an emoji acts as a


placeholder.
 In a real app, you would use [Link](source="[Link]").

� Summary of Key Kivy Concepts Illustrated

Concept Where it appears

App class class RegistrationApp(App): / class


StudentProfileApp(App):
build() method Returns the root widget

Layouts BoxLayout for vertical and horizontal arrangements

Widgets Label, TextInput, Slider, Switch, CheckBox, ProgressBa


r, Button, Image (via emoji placeholder)
Event binding .bind(text=...), .bind(value=...), .bind(active=...
), .bind(on_press=...)
Dynamic UI Progress bar updates live as user types or toggles

Validation Terms checkbox must be accepted before submission

Output Summary displayed in a Label; submit button disabled


after submission
Example Walkthrough (Second Project)

1. Launch the app → A window opens with a form.


2. Enter Name → Progress bar increases from 20% to 40% (because name is filled).
3. Enter Email → Progress increases to 60%.
4. Move Age slider → The label next to slider updates; progress stays at 60%
because age was already counted.
5. Check an interest (e.g., Python) → Progress increases to 80%.
6. Accept Terms → Progress reaches 100%.
7. Click Submit → A summary appears (e.g., "✅ Profile Submitted! …"), and the
submit button becomes disabled.
8. If you try to submit without accepting terms, an error message appears.

This interactive flow demonstrates the power of Kivy’s event-driven model and
how to build a responsive user interface.

Conclusion

Both projects are excellent teaching examples that cover the fundamentals of
Kivy:

 Creating an app class and UI in build()


 Arranging widgets with layouts
 Using various input and display widgets
 Connecting events to functions
 Updating the UI dynamically based on user input
 Validating form data and providing feedback

Students can start with the first project, then extend it to the second to learn
how to add more fields and more complex logic.

You might also like