from this page here i dont know how to destroy current page and move to the next. which function do i need to use or is it possible in python page to create multiple top levels if so how thank you.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# GUI module generated by PAGE version 6.0
# in conjunction with Tcl versioin 8.6
# Nov 29, 2020 07:01:59 PM +0200 platform: Windows NT
import pymongo
import sys
from tkinter import messagebox
client = pymongo.MongoClient()
mydb = client['EZSchooldb']
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
try:
import ttk
py3 = False
except ImportError:
import tkinter.ttk as ttk
py3 = True
import Login_Page_support
import Secretarymainmenu
import Studentmainmenu
import Teachermainmenu
def vp_start_gui():
'''Starting point when module is the main routine.'''
global val, w, root
root = tk.Tk()
top = Login_Page (root)
Login_Page_support.init(root, top)
root.mainloop()
w = None
def create_Login_Page(rt, *args, **kwargs):
'''Starting point when module is imported by another module.
Correct form of call: 'create_Login_Page(root, *args, **kwargs)' .'''
global w, w_win, root
#rt = root
root = rt
w = tk.Toplevel (root)
top = Login_Page (w)
Login_Page_support.init(w, top, *args, **kwargs)
return (w, top)
def destroy_Login_Page():
global w
w.destroy()
w = None
class Login_Page(tk.Frame):
def login(self):
user = self.ID__Entry.get()
pws = self.Password_Entry.get()
global mydb
userobj = mydb['Users'].find_one({'id' :user})
if userobj == None:
tk.messagebox.showwarning(
'Login Page',
'The Id or Password is incorrect'
)
elif pws == userobj['password']:
tk.messagebox.showinfo(
'Login Page',
f"Welcome {userobj['name']}")
**#if userobj['Usertype'] == 1:
# elif userobj['Usertype'] == 2:
# elif userobj['Usertype'] == 3:**
else:
tk.messagebox.showwarning(
'Login Page',
'The Id or Password is incorrect'
)
def __init__(self, top=None):
'''This class configures and populates the toplevel window.
top is the toplevel containing window.'''
_bgcolor = '#d9d9d9' # X11 color: 'gray85'
_fgcolor = '#000000' # X11 color: 'black'
_compcolor = '#d9d9d9' # X11 color: 'gray85'
_ana1color = '#d9d9d9' # X11 color: 'gray85'
_ana2color = '#ececec' # Closest X11 color: 'gray92'
top.geometry("600x525+660+210")
top.minsize(148, 1)
top.maxsize(1924, 1055)
top.resizable(1, 1)
top.title("Login_Page")
top.configure(background="#ffffff")
top.configure(highlightbackground="#d9d9d9")
top.configure(highlightcolor="black")
self.menubar = tk.Menu(top,font="TkMenuFont",bg=_bgcolor,fg=_fgcolor)
top.configure(menu = self.menubar)
self.Login_Button = tk.Button(top)
self.Login_Button.place(relx=0.283, rely=0.577, height=93, width=256)
self.Login_Button.configure(activebackground="#ececec")
self.Login_Button.configure(activeforeground="#000000")
self.Login_Button.configure(background="#e7e7e7")
self.Login_Button.configure(cursor="hand2")
self.Login_Button.configure(disabledforeground="#a3a3a3")
self.Login_Button.configure(foreground="#000000")
self.Login_Button.configure(highlightbackground="#d9d9d9")
self.Login_Button.configure(highlightcolor="black")
self.Login_Button.configure(pady="0")
self.Login_Button.configure(text='''Login''')
self.Login_Button.configure(command= self.login)
self.Label1 = tk.Label(top)
self.Label1.place(relx=0.217, rely=0.267, height=30, width=82)
self.Label1.configure(activebackground="#f9f9f9")
self.Label1.configure(activeforeground="black")
self.Label1.configure(background="#ffffff")
self.Label1.configure(disabledforeground="#a3a3a3")
self.Label1.configure(foreground="#000000")
self.Label1.configure(highlightbackground="#d9d9d9")
self.Label1.configure(highlightcolor="black")
self.Label1.configure(text='''ID''')
self.ID__Entry = tk.Entry(top)
self.ID__Entry.place(relx=0.383, rely=0.267, height=34, relwidth=0.273)
self.ID__Entry.configure(background="white")
self.ID__Entry.configure(disabledforeground="#a3a3a3")
self.ID__Entry.configure(font="TkFixedFont")
self.ID__Entry.configure(foreground="#000000")
self.ID__Entry.configure(highlightbackground="#d9d9d9")
self.ID__Entry.configure(highlightcolor="black")
self.ID__Entry.configure(insertbackground="black")
self.ID__Entry.configure(selectbackground="blue")
self.ID__Entry.configure(selectforeground="white")
self.Label2 = tk.Label(top)
self.Label2.place(relx=0.2, rely=0.423, height=42, width=102)
self.Label2.configure(activebackground="#f9f9f9")
self.Label2.configure(activeforeground="black")
self.Label2.configure(background="#ffffff")
self.Label2.configure(disabledforeground="#a3a3a3")
self.Label2.configure(foreground="#000000")
self.Label2.configure(highlightbackground="#d9d9d9")
self.Label2.configure(highlightcolor="black")
self.Label2.configure(text='''Password''')
self.Password_Entry = tk.Entry(top)
self.Password_Entry.place(relx=0.383, rely=0.423, height=34, relwidth=0.273)
self.Password_Entry.configure(background="white")
self.Password_Entry.configure(disabledforeground="#a3a3a3")
self.Password_Entry.configure(font="TkFixedFont")
self.Password_Entry.configure(foreground="#000000")
self.Password_Entry.configure(highlightbackground="#d9d9d9")
self.Password_Entry.configure(highlightcolor="black")
self.Password_Entry.configure(insertbackground="black")
self.Password_Entry.configure(selectbackground="blue")
self.Password_Entry.configure(selectforeground="white")
self.Message1 = tk.Message(top)
self.Message1.place(relx=0.5, rely=0.114, relheight=0.057
, relwidth=0.677)
self.Message1.configure(background="#ffffff")
self.Message1.configure(foreground="#000000")
self.Message1.configure(highlightbackground="#d9d9d9")
self.Message1.configure(highlightcolor="black")
self.Message1.configure(text=''':נא להכניס פרטי משתמש''')
self.Message1.configure(width=406)
if __name__ == '__main__':
vp_start_gui()
to this page and few others
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# GUI module generated by PAGE version 5.6
# in conjunction with Tcl version 8.6
# Nov 29, 2020 09:43:22 PM +0200 platform: Windows NT
import sys
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
try:
import ttk
py3 = False
except ImportError:
import tkinter.ttk as ttk
py3 = True
import Secretarymainmenu_support
def vp_start_gui():
'''Starting point when module is the main routine.'''
global val, w, root
root = tk.Tk()
top = secretarypage (root)
Secretarymainmenu_support.init(root, top)
root.mainloop()
w = None
def create_secretarypage(rt, *args, **kwargs):
'''Starting point when module is imported by another module.
Correct form of call: 'create_secretarypage(root, *args, **kwargs)' .'''
global w, w_win, root
#rt = root
root = rt
w = tk.Toplevel (root)
top = secretarypage (w)
Secretarymainmenu_support.init(w, top, *args, **kwargs)
return (w, top)
def destroy_secretarypage():
global w
w.destroy()
w = None
class secretarypage:
def __init__(self, top=None):
'''This class configures and populates the toplevel window.
top is the toplevel containing window.'''
_bgcolor = '#d9d9d9' # X11 color: 'gray85'
_fgcolor = '#000000' # X11 color: 'black'
_compcolor = '#d9d9d9' # X11 color: 'gray85'
_ana1color = '#d9d9d9' # X11 color: 'gray85'
_ana2color = '#ececec' # Closest X11 color: 'gray92'
top.geometry("1920x1051+-9+-9")
top.minsize(148, 1)
top.maxsize(1924, 1055)
top.resizable(1, 1)
top.title("Secretary main menu")
top.configure(background="#ffffff")
top.configure(highlightbackground="#d9d9d9")
top.configure(highlightcolor="black")
self.student_schedule = tk.Button(top)
self.student_schedule.place(relx=0.219, rely=0.171, height=93, width=186)
self.student_schedule.configure(activebackground="#ececec")
self.student_schedule.configure(activeforeground="#000000")
self.student_schedule.configure(background="#d9d9d9")
self.student_schedule.configure(disabledforeground="#a3a3a3")
self.student_schedule.configure(foreground="#000000")
self.student_schedule.configure(highlightbackground="#d9d9d9")
self.student_schedule.configure(highlightcolor="black")
self.student_schedule.configure(pady="0")
self.student_schedule.configure(text='''עדכון מערכת שעות תלמיד''')
self.teacher_schedule = tk.Button(top)
self.teacher_schedule.place(relx=0.344, rely=0.17, height=93, width=186)
self.teacher_schedule.configure(activebackground="#ececec")
self.teacher_schedule.configure(activeforeground="#000000")
self.teacher_schedule.configure(background="#d9d9d9")
self.teacher_schedule.configure(disabledforeground="#a3a3a3")
self.teacher_schedule.configure(foreground="#000000")
self.teacher_schedule.configure(highlightbackground="#d9d9d9")
self.teacher_schedule.configure(highlightcolor="black")
self.teacher_schedule.configure(pady="0")
self.teacher_schedule.configure(text='''עדכון מערכת שעות מורה''')
self.health = tk.Button(top)
self.health.place(relx=0.474, rely=0.171, height=93, width=186)
self.health.configure(activebackground="#ececec")
self.health.configure(activeforeground="#000000")
self.health.configure(background="#d9d9d9")
self.health.configure(disabledforeground="#a3a3a3")
self.health.configure(foreground="#000000")
self.health.configure(highlightbackground="#d9d9d9")
self.health.configure(highlightcolor="black")
self.health.configure(pady="0")
self.health.configure(text='''הצהרת בריאות''')
self.menubar = tk.Menu(top,font="TkMenuFont",bg=_bgcolor,fg=_fgcolor)
top.configure(menu = self.menubar)
self.meetings = tk.Button(top)
self.meetings.place(relx=0.609, rely=0.171, height=93, width=186)
self.meetings.configure(activebackground="#ececec")
self.meetings.configure(activeforeground="#000000")
self.meetings.configure(background="#d9d9d9")
self.meetings.configure(disabledforeground="#a3a3a3")
self.meetings.configure(foreground="#000000")
self.meetings.configure(highlightbackground="#d9d9d9")
self.meetings.configure(highlightcolor="black")
self.meetings.configure(pady="0")
self.meetings.configure(text='''יומן פגישות''')
self.work_clock = tk.Button(top)
self.work_clock.place(relx=0.74, rely=0.171, height=93, width=186)
self.work_clock.configure(activebackground="#ececec")
self.work_clock.configure(activeforeground="#000000")
self.work_clock.configure(background="#d9d9d9")
self.work_clock.configure(disabledforeground="#a3a3a3")
self.work_clock.configure(foreground="#000000")
self.work_clock.configure(highlightbackground="#d9d9d9")
self.work_clock.configure(highlightcolor="black")
self.work_clock.configure(pady="0")
self.work_clock.configure(text='''שעון עבודה''')
self.inventory_payment = tk.Button(top)
self.inventory_payment.place(relx=0.219, rely=0.324, height=93
, width=186)
self.inventory_payment.configure(activebackground="#ececec")
self.inventory_payment.configure(activeforeground="#000000")
self.inventory_payment.configure(background="#d9d9d9")
self.inventory_payment.configure(disabledforeground="#a3a3a3")
self.inventory_payment.configure(foreground="#000000")
self.inventory_payment.configure(highlightbackground="#d9d9d9")
self.inventory_payment.configure(highlightcolor="black")
self.inventory_payment.configure(pady="0")
self.inventory_payment.configure(text='''גביית תשלום - ציוד''')
self.tuition_fee = tk.Button(top)
self.tuition_fee.place(relx=0.344, rely=0.324, height=93, width=186)
self.tuition_fee.configure(activebackground="#ececec")
self.tuition_fee.configure(activeforeground="#000000")
self.tuition_fee.configure(background="#d9d9d9")
self.tuition_fee.configure(disabledforeground="#a3a3a3")
self.tuition_fee.configure(foreground="#000000")
self.tuition_fee.configure(highlightbackground="#d9d9d9")
self.tuition_fee.configure(highlightcolor="black")
self.tuition_fee.configure(pady="0")
self.tuition_fee.configure(text='''גביית תשלום - שכר לימוד''')
self.teachers_survey = tk.Button(top)
self.teachers_survey.place(relx=0.474, rely=0.324, height=93, width=186)
self.teachers_survey.configure(activebackground="#ececec")
self.teachers_survey.configure(activeforeground="#000000")
self.teachers_survey.configure(background="#d9d9d9")
self.teachers_survey.configure(disabledforeground="#a3a3a3")
self.teachers_survey.configure(foreground="#000000")
self.teachers_survey.configure(highlightbackground="#d9d9d9")
self.teachers_survey.configure(highlightcolor="black")
self.teachers_survey.configure(pady="0")
self.teachers_survey.configure(text='''סקר מורים''')
self.forum = tk.Button(top)
self.forum.place(relx=0.609, rely=0.324, height=93, width=186)
self.forum.configure(activebackground="#ececec")
self.forum.configure(activeforeground="#000000")
self.forum.configure(background="#d9d9d9")
self.forum.configure(disabledforeground="#a3a3a3")
self.forum.configure(foreground="#000000")
self.forum.configure(highlightbackground="#d9d9d9")
self.forum.configure(highlightcolor="black")
self.forum.configure(pady="0")
self.forum.configure(text='''פורום''')
self.inventory_manage = tk.Button(top)
self.inventory_manage.place(relx=0.74, rely=0.324, height=93, width=186)
self.inventory_manage.configure(activebackground="#ececec")
self.inventory_manage.configure(activeforeground="#000000")
self.inventory_manage.configure(background="#d9d9d9")
self.inventory_manage.configure(disabledforeground="#a3a3a3")
self.inventory_manage.configure(foreground="#000000")
self.inventory_manage.configure(highlightbackground="#d9d9d9")
self.inventory_manage.configure(highlightcolor="black")
self.inventory_manage.configure(pady="0")
self.inventory_manage.configure(text='''ניהול מלאי ציוד משרדי''')
if __name__ == '__main__':
vp_start_gui()
In class Login_Page function Login i try to open diffrent top levels acording to user classification which is 1-3 using mongodb i cheack the user data i stored in my database thank you in advance for the help