Skip to content

Commit

Permalink
Python Gui Project
Browse files Browse the repository at this point in the history
  • Loading branch information
Savvylion committed Nov 20, 2022
1 parent 4e21e78 commit 6e8f77f
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import tkinter
from tkinter import ttk
from tkinter import messagebox


def enter_data()


accepted = accept_var.get()

if accepted == "Accepted":
# user info
firstname = first_name_entry.get()
lastname = last_name_entry.get()

if firstname and lastname:
title = title_combobox.get()
age = age_spinbox.get()
nationality = nationality_combox.get()

# Course info
registration_status = reg_status_var.get()
numcourses = numcourses_spinbox.get()
numsemesters = numsemesters_spinbox.get()

print("First name: ", firstname, "Last name: ", lastname)
print("Title: ", title, "Age: ", age, "Nationality: ", nationality)
print("# Courses: ", numcourses, "# Semesters: ", numsemesters)
print("Registration status", registration_status)
print("---------------------------------")

else:
tkinter.messagebox.showwarning(
title="Error", message="First name and last name are required.")
else:
tkinter.messagebox.showwarning(
title="Error", message="You have not accepted the terms.")

window = tkinter.Tk()
window.title("Data Entry Form")
46 changes: 46 additions & 0 deletions Main2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import tkinter
from tkinter import ttk


window = tkinter.Tk()
window.title("Data Entry Form")

frame = tkinter.Frame(window)
frame.pack()


# Saving User Info
user_info_frame = tkinter.LabelFrame(frame, text="User Informaton")
user_info_frame.grid(row=0, column=0, padx=20, pady=20)

first_name_label = tkinter.Label(user_info_frame, text="First Name")
first_name_label.grid(row=0, column=0)
last_name_label = tkinter.Label(user_info_frame, text="Last Name")
last_name_label.grid(row=0, column=1)

first_name_entry = tkinter.Entry(user_info_frame)
last_name_entry = tkinter.Entry(user_info_frame)
first_name_entry.grid(row=1, column=0)
last_name_entry.grid(row=1, column=1)

title_label = tkinter.Label(user_info_frame, text="Title")
title_combobox = ttk.Combobox(user_info_frame, values=["", "Mr.", "Ms", "Dr."])
title_label.grid(row=0, column=2)
title_combobox.grid(row=1, column=2)

age_label = tkinter.Label(user_info_frame, text="Age")
age_spinbox = tkinter.Spinbox(user_info_frame, from_=18, to=110)
age_label.grid(row=2, column=0)
age_spinbox.grid(row=3, column=0)

nationality_label = tkinter.Label(user_info_frame, text="Nationality")
nationality_combobox = ttk.Combobox(
user_info_frame, values=["Africa", "Anartica.", "Artica", "Asia", "Europe", "North America", "Oceania", "South America"])
nationality_label.grid(row=2, column=1)
nationality_combobox.grid(row=3, column=1)

for widget in user_info_frame.winfo_children():
widget.grid_configure(padx=10, pady=5)


window.mainloop()

0 comments on commit 6e8f77f

Please sign in to comment.