I-53 Assignment 3 - GUI
I-53 Assignment 3 - GUI
Class: FE Semester: II
Course Code: VSEC202 Course Name: PYTHON PROGRAMMING
Evaluation
Performance Indicator Max. Marks Marks Obtained
Legibility 4
Demonstrated Knowledge 4
Timely submission 2
Total 10
Checked by
Practice Problems/GUI
Output:
Output:
3 Counter Application
● Create a window with a label showing a number (starting from 0).
● Add "Increase" and "Decrease" buttons to update the number.
Code:
from tkinter import *
root = Tk()
def increaser():
num1 = int(label1['text'])
num1 = num1+1
label1.config(text=num1)
def decreaser():
num1 = label1['text']
num1 = num1-1
label1.config(text=num1)
root.geometry("300x200")
root.title("Chaitanya Shelar / I / 53")
label1 = Label(root, text=0)
label1.grid(row = 0, column=0, columnspan=2, sticky = EW)
button1 = Button(root, text="Decrease", command=decreaser)
button1.grid(row=1, column = 0, sticky=EW)
button2 = Button(root, text="Increase", command=increaser)
button2.grid(row = 1, column = 1)
root.mainloop()
Output:
Output:
Output:
8 To-Do List
● Create an Entry box for adding tasks.
● Add a "Add Task" button to store tasks in a Listbox.
● Add a "Delete Task" button to remove selected tasks.
Code:
from tkinter import *
def addTask():
task = taskentry.get()
if task:
dispList.insert(END, task)
def delTask():
indexnum = dispList.curselection()
if indexnum:
dispList.delete(indexnum[0])
root = Tk()
root.title("Chaitanya Shelar / I / 53")
root.geometry("300x200")
label1 = Label(root, text="Enter Task: ")
label1.grid(row = 0, column = 0)
taskentry = Entry(root)
taskentry.grid(row = 0, column = 1)
addT = Button(root, text = "Add Task", command = addTask)
addT.grid(row = 0, column = 2, sticky=EW)
delT= Button(root, text = "Delete Task", command=delTask)
Output:
10 StopWatch Timer
● Create a timer with Start, Stop, and Reset buttons.
● Display the elapsed time in seconds.
Code:
from tkinter import *
global eTime
eTime = 0
def start():
global running
running = True
update_timer()
def stop():
global running
running = False
def reset():
global running, eTime
running = False
eTime = 0
timeholder.config(text=f"{eTime:.2f}")
def update_timer():
global eTime
if running:
eTime = eTime + 0.01
timeholder.config(text=f"{eTime:.2f}")
root.after(10, update_timer)
root = Tk()
Output: