-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path25-gui.py
More file actions
45 lines (33 loc) · 1.11 KB
/
25-gui.py
File metadata and controls
45 lines (33 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import tkinter as tk
from tkinter import ttk
def add_employee():
name = entry_name.get()
email = entry_email.get()
# Add code here to store the employee data somewhere (e.g., database, file, list, etc.)
# For now, we're just displaying the data in the table
tree.insert("", tk.END, values=(name, email))
# Clear the entry fields after adding an employee
entry_name.delete(0, tk.END)
entry_email.delete(0, tk.END)
# Main window configuration
root = tk.Tk()
root.title("Employee Registration")
# Create a table using the Treeview widget
tree = ttk.Treeview(root, columns=("Name", "Email"))
tree.heading("Name", text="Name")
tree.heading("Email", text="Email")
tree.pack()
# Create entry fields for name and position
label_name = tk.Label(root, text="Name:")
label_name.pack()
entry_name = tk.Entry(root)
entry_name.pack()
label_email = tk.Label(root, text="Email:")
label_email.pack()
entry_email = tk.Entry(root)
entry_email.pack()
# Button to add an employee
button_add = tk.Button(root, text="Add", command=add_employee)
button_add.pack()
# Start the program's execution
root.mainloop()