update,
This commit is contained in:
286
hdhdjshxh/task2/_backup/draft0002/src/Assignment.py
Normal file
286
hdhdjshxh/task2/_backup/draft0002/src/Assignment.py
Normal file
@@ -0,0 +1,286 @@
|
||||
import tkinter
|
||||
import tkinter.ttk
|
||||
|
||||
import tkinter.messagebox
|
||||
import tkinter.scrolledtext
|
||||
from tkinter import *
|
||||
|
||||
###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
|
||||
row = 0
|
||||
frm_content = tkinter.Frame(frm_base)
|
||||
frm_content.pack(fill=tkinter.BOTH)
|
||||
frm_content.grid_columnconfigure(2,weight=1)
|
||||
|
||||
|
||||
lbl_name = tkinter.Label(frm_content, text="Applicant Name" , anchor="w", justify="left", width=20)
|
||||
lbl_name.grid(row=row, column=0)
|
||||
ent_name = tkinter.Entry(frm_content)
|
||||
ent_name.grid(row=row, column=1, columnspan=2, sticky="nsew", pady=(10,10), padx=(10,10))
|
||||
row += 1
|
||||
|
||||
lbl_name = tkinter.Label(frm_content, text="Applicant Email" , anchor="w", justify="left", width=20)
|
||||
lbl_name.grid(row=row, column=0)
|
||||
ent_name = tkinter.Entry(frm_content)
|
||||
ent_name.grid(row=row, column=1, columnspan=2, sticky="nsew", pady=(10,10), padx=(10,10))
|
||||
row += 1
|
||||
|
||||
|
||||
# ask genden with radio button, male or female
|
||||
lbl_gender = tkinter.Label(frm_content, text="Gender" , anchor="w", justify="left", width=20)
|
||||
lbl_gender.grid(row=row, column=0)
|
||||
rad_male = tkinter.Radiobutton(frm_content, text="Male")
|
||||
rad_male.grid(row=row, column=1)
|
||||
rad_female = tkinter.Radiobutton(frm_content, text="Female")
|
||||
rad_female.grid(row=row, column=2)
|
||||
row += 1
|
||||
|
||||
lbl_name = tkinter.Label(frm_content, text="Date of Birth" , anchor="w", justify="left", width=20)
|
||||
lbl_name.grid(row=row, column=0)
|
||||
ent_name = tkinter.Entry(frm_content)
|
||||
ent_name.grid(row=row, column=1, columnspan=2, sticky="nsew", pady=(10,10), padx=(10,10))
|
||||
row += 1
|
||||
|
||||
lbl_name = tkinter.Label(frm_content, text="Apply Programme" , anchor="w", justify="left", width=20)
|
||||
lbl_name.grid(row=row, column=0)
|
||||
|
||||
# combobox for apply programme
|
||||
lst_programme=[]
|
||||
monthchoosen = tkinter.ttk.Combobox(frm_content, textvariable=lst_programme, values=lst_programme, )
|
||||
monthchoosen.grid(row=row, column=1, columnspan=2, sticky="nsew", pady=(10,10), padx=(10,10))
|
||||
|
||||
|
||||
row += 1
|
||||
|
||||
|
||||
|
||||
###
|
||||
|
||||
|
||||
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
|
||||
row = 0
|
||||
frm_content = tkinter.Frame(frm_base)
|
||||
frm_content.pack(fill=tkinter.BOTH)
|
||||
frm_content.grid_columnconfigure(2,weight=1)
|
||||
|
||||
lbl_name = tkinter.Label(frm_content, text="Institution Name", anchor="w", justify="left", width=20)
|
||||
lbl_name.grid(row=row, column=0)
|
||||
ent_name = tkinter.Entry(frm_content)
|
||||
ent_name.grid(row=row, column=1, columnspan=2, sticky="nsew", pady=(10,10), padx=(10,10))
|
||||
row += 1
|
||||
|
||||
lbl_name = tkinter.Label(frm_content, text="Programme Title", anchor="w", justify="left", width=20)
|
||||
lbl_name.grid(row=row, column=0)
|
||||
ent_name = tkinter.Entry(frm_content)
|
||||
ent_name.grid(row=row, column=1, columnspan=2, sticky="nsew", pady=(10,10), padx=(10,10))
|
||||
row += 1
|
||||
|
||||
lbl_name = tkinter.Label(frm_content, text="GPA", anchor="w", justify="left", width=20)
|
||||
lbl_name.grid(row=row, column=0)
|
||||
ent_name = tkinter.Entry(frm_content)
|
||||
ent_name.grid(row=row, column=1, columnspan=2, sticky="nsew", pady=(10,10), padx=(10,10))
|
||||
row += 1
|
||||
|
||||
lbl_name = tkinter.Label(frm_content, text="Expected Graduation Year", anchor="w", justify="left", width=20)
|
||||
lbl_name.grid(row=row, column=0)
|
||||
ent_name = tkinter.Entry(frm_content)
|
||||
ent_name.grid(row=row, column=1, columnspan=2, sticky="nsew", pady=(10,10), padx=(10,10))
|
||||
row += 1
|
||||
###
|
||||
|
||||
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
|
||||
row = 0
|
||||
frm_content = tkinter.Frame(frm_base)
|
||||
frm_content.pack(fill=tkinter.BOTH)
|
||||
frm_content.grid_columnconfigure(2,weight=1)
|
||||
|
||||
# textbox for summary
|
||||
txt_summary = tkinter.Text(frm_content, height=10)
|
||||
txt_summary.grid(row=row, column=1, columnspan=2, sticky="nsew", pady=(1,1), padx=(1,1))
|
||||
row += 1
|
||||
|
||||
|
||||
# right justify button with text "show"
|
||||
btn_show = tkinter.Button(frm_base, text="Show", anchor=tkinter.E)
|
||||
btn_show.pack(side=tkinter.RIGHT)
|
||||
|
||||
# btn_show = tkinter.Button(frm_content, text="Show", anchor=tkinter.E)
|
||||
# btn_show.grid(row=row, column=2, pady=(10,10), padx=(10,10))
|
||||
|
||||
|
||||
|
||||
###
|
||||
|
||||
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()
|
10
hdhdjshxh/task2/_backup/draft0002/src/test.bat
Normal file
10
hdhdjshxh/task2/_backup/draft0002/src/test.bat
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
@REM rm *.bas
|
||||
@REM rm *.frm
|
||||
@REM rm *.frx
|
||||
@REM timeout 1
|
||||
|
||||
:loop
|
||||
python ./Assignment.py
|
||||
timeout /t 1
|
||||
goto loop
|
Reference in New Issue
Block a user