Hi,
I'm still trying to straighten out Tk in my mind. :eek: What I want to do is, under certain circumstances, completely clear the screen and display something new. Instead, it displays the new stuff together with the old. Here's excerpts from the code, with the offending line marked with ===>:
#main
mainw = Tk()
init(mainw)
app = Application(mainw)
login_win = login.Login(app)
app.display_screen()
mainw.tkraise()
mainw.mainloop()
...
class Application(Frame):
"""The main submit application"""
def __init__(self, master):
"""initialize frame"""
Frame.__init__(self, master)
self.master = master
self.grid()
...
def display_screen(self):
if self.authentication == "Root":
self.title = Label(self,text="User: Root")
self.title.grid(column=0,row=0)
self.root_screen()
else:
self.title = Label(self, text="User: %s" % (self.userid))
self.title.grid(column=0,row=0)
self.user_screen(self.userid)
def root_screen(self):
self.frame = Frame(self)
self.root_dir_str = StringVar()
self.root_dir_str.set("Root Directory: %s" % self.root_dir)
self.frame.root_dir_label = \
Label(self,textvariable=self.root_dir_str)
self.frame.root_dir_label.grid(column=0,row=1)
self.frame.buttons = [Button(self,text="Manage Accounts", \
command=self.manage_accounts),\
Button(self,text="Manage Assignments", \
command=self.manage_assignments),\
Button(self,text="Submit as Proxy",\
command=self.proxy),\
Button(self,text="Change Password",\
command=self.change_root_pwd),\
Button(self,text="Quit",\
command=self.Quit)\
]
for i in self.frame.buttons:
i.grid(column=0,row=self.frame.buttons.index(i)+2,pady=10)
self.frame.grid()
...
def proxy(self):
edit = editdialog.Edit_Dialog(self, None, ("Enter UserID", ))
for i in self.usr_list:
# check whether entered id is on user list
if edit.tup[0] == i[0]:
self.authentication = "User"
self.userid = edit.tup[0]
self.title = Label(self,text="Proxy Submit for User: %s"\
%(self.userid))
self.title.grid(column=0,row=0)
===> self.frame.destroy()
self.user_screen(self.userid, proxy = True)
...
The key point is that if the root user hits the "Submit as Proxy" button, his current root_user frame should be destroyed and a proxy user_screen should be displayed. What happens instead is that the proxy user_screen gets gridded directly below the root_user frame.
I don't get it. :twisted:
Thanks,
Jeff Cagle