python programmer
Coding is life
25/12/2025
student managment system using python tkinter
Learn python with us 💻💻💻
04/12/2025
Learn Data structure in python from Bsic with GUI
'''- Push
- Pop
- Peek
- *Clear Stack*
- *Show Stack Sizepython'''
import tkinter as tk
from tkinter import messagebox
stack = []
def push():
val = entry.get()
if val:
stack.append(val)
entry.delete(0, tk.END)
update_display()
else:
messagebox.showwarning("Input needed", "Please enter a value")
def pop_item():
if stack:
popped = stack.pop()
messagebox.showinfo("Popped", f"Removed: {popped}")
update_display()
else:
messagebox.showwarning("Empty Stack", "Nothing to pop")
def peek():
if stack:
top = stack[-1]
messagebox.showinfo("Top Item", f"Top: {top}")
else:
messagebox.showinfo("Empty Stack", "Stack is empty")
def clear_stack():
stack.clear()
update_display()
messagebox.showinfo("Cleared", "Stack has been cleared")
def update_display():
stack_display = " -> ".join(stack) if stack else "Stack is empty"
display_label.config(text=stack_display)
size_label.config(text=f"Size: {len(stack)}")
setup
root = tk.Tk()
root.title("Stack App with Tkinter")
root.geometry("400x350")
tk.Label(root, text="Enter value to push:").pack(pady=5)
entry = tk.Entry(root)
entry.pack(pady=5)
tk.Button(root, text="Push", width=15, command=push).pack(pady=5)
tk.Button(root, text="Pop", width=15, command=pop_item).pack(pady=5)
tk.Button(root, text="Peek (Top)", width=15, command=peek).pack(pady=5)
tk.Button(root, text="Clear Stack", width=15, command=clear_stack).pack(pady=5)
display_label = tk.Label(root, text="Stack is empty", bg="orange",fg="white", width=40, height=10)
display_label.pack(pady=10)
size_label = tk.Label(root, text="Size: 0")
size_label.pack()
root.mainloop()
11/05/2025
Animated Login& signup page Design
11/05/2025
Easypay app design and functionality for source code inbox me
06/05/2025
Global school management project
Click here to claim your Sponsored Listing.
Category
Contact the public figure
Telephone
Address
Peshawer
Peshawar
25000