Content
@
0 reply
0 recast
0 reaction
Muhammad Bilal 🎭
@bilalsharief
Here are some basic Python codes to generate a simple app: 1. Hello World App: ``` import tkinter as tk root = tk.Tk() label = tk.Label(root, text="Hello World!") label.pack() root.mainloop() ``` 1. To-Do List App: ``` import tkinter as tk from tkinter import messagebox def add_task(): tasks.append(entry.get()) entry.delete(0, tk.END) listbox.insert(tk.END, tasks[-1]) def delete_task(): try: task_index = listbox.curselection()[0] listbox.delete(task_index) tasks.pop(task_index) except: pass root = tk.Tk() entry = tk.Entry(root) entry.pack() button_add = tk.Button(root, text="Add task", command=add_task) button_add.pack() listbox = tk.Listbox(root) listbox.pack() button_delete = tk.Button(root, text="Delete task", command=delete_task) button_delete.pack() tasks = [] root.mainloop() ``` 1. Simple Calculator App: ``` import tkinter as tk def calculate(): try: result = eval(entry.get()) label.config(text = "Result: " + str(result)) except: label.config(text = "Invalid
1 reply
0 recast
0 reaction
pyrospark
@pyrospark
Don’t paste code as text.
0 reply
0 recast
0 reaction