196 lines
4.4 KiB
Python
196 lines
4.4 KiB
Python
import tkinter
|
|
import tkinter.messagebox
|
|
import tkinter.scrolledtext
|
|
|
|
|
|
###class starts
|
|
class HDinfo():
|
|
pass#remove it when you complete the codings
|
|
|
|
#constructor __init__
|
|
|
|
# __str__ method
|
|
|
|
|
|
class Applicant():
|
|
pass#remove it when you complete the codings
|
|
|
|
#constructor __init__
|
|
|
|
# __str__ method
|
|
|
|
#Set Personal Info Method
|
|
|
|
#Set HD Info Method
|
|
|
|
|
|
applicant = Applicant()
|
|
###class ends
|
|
|
|
|
|
###Tkinter starts
|
|
|
|
|
|
#Parent class for Personal and HighDiploma
|
|
class ApplicationPage(tkinter.Frame):
|
|
"""Base class for managed pages. Provides methods to be overridden by subclasses."""
|
|
|
|
def __init__(self, master):
|
|
super().__init__(master)
|
|
|
|
def is_complete(self) -> bool:
|
|
"""Check if the current page is complete."""
|
|
return True
|
|
|
|
|
|
class Personal(ApplicationPage):
|
|
def __init__(self, master):
|
|
super().__init__(master)
|
|
|
|
|
|
|
|
frm_base = tkinter.Frame(self)
|
|
frm_base.pack(fill=tkinter.BOTH, expand=True)
|
|
|
|
frm_title = tkinter.Frame(frm_base)
|
|
frm_title.pack(fill=tkinter.BOTH)
|
|
|
|
|
|
lbl_title = tkinter.Label(frm_title, text="Personal Infromation", font=("bold", 15))
|
|
lbl_title.pack(anchor=tkinter.W)
|
|
|
|
###
|
|
#Write your coding here
|
|
|
|
###
|
|
|
|
|
|
def is_complete(self):
|
|
|
|
###
|
|
#Write your coding here
|
|
|
|
###
|
|
|
|
return True
|
|
|
|
|
|
class HighDiploma(ApplicationPage):
|
|
def __init__(self, master):
|
|
super().__init__(master)
|
|
|
|
frm_base = tkinter.Frame(self)
|
|
frm_base.pack(fill=tkinter.BOTH, expand=True)
|
|
|
|
frm_title = tkinter.Frame(frm_base)
|
|
frm_title.pack(fill=tkinter.BOTH)
|
|
|
|
lbl_title = tkinter.Label(frm_title, text="Higher Diploma Information", font=("bold", 15))
|
|
lbl_title.pack(anchor=tkinter.W)
|
|
|
|
|
|
###
|
|
#Write your coding here
|
|
|
|
###
|
|
|
|
def is_complete(self):
|
|
###
|
|
#Write your coding here
|
|
|
|
###
|
|
return True
|
|
|
|
|
|
class Result(ApplicationPage):
|
|
def __init__(self, master):
|
|
super().__init__(master)
|
|
|
|
frm_base = tkinter.Frame(self)
|
|
frm_base.pack(fill=tkinter.BOTH, expand=True)
|
|
|
|
frm_title = tkinter.Frame(frm_base)
|
|
frm_title.pack(fill=tkinter.BOTH)
|
|
|
|
lbl_title = tkinter.Label(frm_base, text="Summary", font=("bold", 15))
|
|
lbl_title.pack(anchor=tkinter.W)
|
|
|
|
#Summary Output
|
|
###
|
|
#Write your coding here
|
|
|
|
###
|
|
|
|
def show(self): #Show Button method
|
|
pass#remove it when you complete the codings
|
|
###
|
|
#Write your coding here
|
|
|
|
###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Application(tkinter.Tk):
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
# Configure GUI
|
|
self.title("Undergraduate Application Form")
|
|
self.geometry("450x300")
|
|
|
|
# Content Frame
|
|
frm_content = tkinter.Frame(self, relief=tkinter.RIDGE, borderwidth=1)
|
|
frm_content.pack(fill=tkinter.BOTH, expand=True)
|
|
frm_content.rowconfigure(0, weight=1)
|
|
frm_content.columnconfigure(0, weight=1)
|
|
|
|
|
|
|
|
# Application Pages
|
|
self.__frames: list[ApplicationPage] = [
|
|
Personal(frm_content),
|
|
HighDiploma(frm_content),
|
|
Result(frm_content),
|
|
]
|
|
for i in self.__frames:
|
|
i.grid(row=0, column=0, sticky=tkinter.NSEW)
|
|
self.__current_page = 0
|
|
self.__frames[self.__current_page].tkraise()
|
|
|
|
# Bottom Frame
|
|
frm_button = tkinter.Frame(self, padx=4, pady=4)
|
|
frm_button.pack(side=tkinter.BOTTOM, fill=tkinter.X)
|
|
|
|
# Next Button
|
|
self.btn_next = tkinter.Button(frm_button, text="Next", command=self.next_page)
|
|
self.btn_next.pack(side=tkinter.RIGHT)
|
|
|
|
# Quit Button
|
|
self.btn_quit = tkinter.Button(frm_button, text="Quit", command=self.destroy)
|
|
|
|
def next_page(self):
|
|
# Check if the current page is complete
|
|
if not self.__frames[self.__current_page].is_complete():
|
|
tkinter.messagebox.showinfo(
|
|
"Information", "Please fill the missing fields."
|
|
)
|
|
return
|
|
|
|
# Navigate to next page
|
|
self.__current_page += 1
|
|
self.__frames[self.__current_page].tkraise()
|
|
|
|
# If we reached the last page, replace the next button with quit button
|
|
if self.__current_page + 1 == len(self.__frames):
|
|
self.btn_next.pack_forget()
|
|
self.btn_quit.pack(side=tkinter.RIGHT)
|
|
###Tkinter ends
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app = Application()
|
|
app.mainloop()
|