I am making a GUI with Tkinter and need to know which frame is on top so one of the lowered ones does not enter one of its loop and changes some settings.
I have already tried with
self.tk.eval('frame stackorder '+str(self.frames["StartPage"])+' isabove '+str(self.frames["Wallpaper"]))=='1'
self being my root (its a class) and get this error
_tkinter.TclError: bad window path name "stackorder"
also
self.tk.eval('wm stackorder '+str(self.frames["StartPage"])
gives me the this error:
_tkinter.TclError: window ".!frame.!startpage" isn't a top-level window
This is the way I create and change between frames
self.frames = {}
for F in (StartPage, PageOne, PageTwo):
page_name = F.__name__
frame = F(parent=container, controller=self)
self.frames[page_name] = frame
# put all of the pages in the same location;
# the one on the top of the stacking order
# will be the one that is visible.
frame.grid(row=0, column=0, sticky="nsew")
self.show_frame("StartPage")
def show_frame(self, page_name):
'''Show a frame for the given page name'''
frame = self.frames[page_name]
frame.tkraise()
I took the way to change frame from here (Switch between two frames in tkinter) but dont know how to know which one is on top.