C
Clara
Hi,...
I meant to write an application where there is a button in a window and
when you click on the button, it will open a new window, but I want the
first window to close, replaced by the second window.
I open a login window and start the mainloop, when the user click on
the login button, the __call__ function of VerifyProcessor is executed
and it will call the new window which is the file manager window
The thing is,.. I don't know how to exit the first mainloop and then
display the second window...I even tried calling the mainloop again but
a weird thing happens. I really need help because otherwise I'm stuck
here and I can't complete my assignment. The following is my code:
from login import LoginMenu
app = LoginMenu()
app.master.title("Login Menu")
app.master.maxsize(300,200)
app.mainloop()
======================================
class LoginMenu(Frame):
def createWidgets(self):
self.loginButton = Button(self, text='Login', command =
VerifyProcessor(self.x, self.y, self.msg, self.messageLabel) )
def __init__(self, master=None):
Frame.__init__(self, master)
self.grid(column=6, row=4)
self.createWidgets()
class VerifyProcessor:
def __init__(self, thename, thepass, msg, msglabel):
self.username = thename
self.password = thepass
self.msgVar = msg
self.msgLabel = msglabel
def __call__(self):
import md5
import dictionaryloader
found = 0
theDict = dictionaryloader.loadFrom("Dicttxt")
entries = theDict.items()
for theuser, thepass in entries:
if self.username.get() == theuser and
md5.new(self.password.get()).hexdigest() == thepass:
found=1
from mainmenu import FileManager
app2 = FileManager(self.username.get())
app2.master.title("File Manager")
app2.master.maxsize("400,1500")
app2.mainloop()
=====================================================================
class FileManager(Frame):
def createWidgets(self, username):
...
def __init__(self, username, master=None):
Frame.__init__(self, master)
self.grid(column=6, row=6)
self.createWidgets(username)
======================================================================
I meant to write an application where there is a button in a window and
when you click on the button, it will open a new window, but I want the
first window to close, replaced by the second window.
I open a login window and start the mainloop, when the user click on
the login button, the __call__ function of VerifyProcessor is executed
and it will call the new window which is the file manager window
The thing is,.. I don't know how to exit the first mainloop and then
display the second window...I even tried calling the mainloop again but
a weird thing happens. I really need help because otherwise I'm stuck
here and I can't complete my assignment. The following is my code:
from login import LoginMenu
app = LoginMenu()
app.master.title("Login Menu")
app.master.maxsize(300,200)
app.mainloop()
======================================
class LoginMenu(Frame):
def createWidgets(self):
self.loginButton = Button(self, text='Login', command =
VerifyProcessor(self.x, self.y, self.msg, self.messageLabel) )
def __init__(self, master=None):
Frame.__init__(self, master)
self.grid(column=6, row=4)
self.createWidgets()
class VerifyProcessor:
def __init__(self, thename, thepass, msg, msglabel):
self.username = thename
self.password = thepass
self.msgVar = msg
self.msgLabel = msglabel
def __call__(self):
import md5
import dictionaryloader
found = 0
theDict = dictionaryloader.loadFrom("Dicttxt")
entries = theDict.items()
for theuser, thepass in entries:
if self.username.get() == theuser and
md5.new(self.password.get()).hexdigest() == thepass:
found=1
from mainmenu import FileManager
app2 = FileManager(self.username.get())
app2.master.title("File Manager")
app2.master.maxsize("400,1500")
app2.mainloop()
=====================================================================
class FileManager(Frame):
def createWidgets(self, username):
...
def __init__(self, username, master=None):
Frame.__init__(self, master)
self.grid(column=6, row=6)
self.createWidgets(username)
======================================================================