I've come across this great tutorial - https://www.youtube.com/watch?v=jBUpjijYtCk&index=4&list=PLQVvvaa0QuDclKx-QpC9wntnURXVJqLyk
its part 3, its essentially just about being able to swap out frames with the press of a button. I've pretty much followed all the steps and everything works up until about 7.06
here is the code -
import Tkinter as tk
class MainApp(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
container = tk.Frame(self)
container.pack(side = "top", fill = "both", expand = True)
container.grid_rowconfigure(0, weight = 1)
container.grid_columnconfigure(0,weight = 1)
self.frames = {}
for F in (StartPage,PageOne):
frame = F(container,self)
self.frames[F] = frame
frame.grid(row = 0, column = 0, sticky = "w")
self.show_frame(StartPage)
def show_frame(self,cont):
frame = self.frames[cont]
frame.tkraise()
class StartPage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self,parent)
lbl = tk.Label(self, text = "Start Page", font =("Helvetica",12,"bold"))
lbl.pack()
btn = tk.Button(self,text = "Button to next frame", font = ("Helvetica",12,"bold")
,command =lambda: controller.show_frame(PageOne))
btn.pack()
class PageOne(tk.Frame):
def __int__(self,parent,controller):
tk.Frame.__init__(self,parent)
lbl = tk.Label(self, text = "page 1", font =("Helvetica",12,"bold"))
lbl.pack()
btn1 = tk.Button(self,text = "Button to pageOne", font = ("Helvetica",12,"bold")
,command =lambda: controller.show_frame(StartPage))
btn1.pack()
app = MainApp()
app.mainloop()
an error is thrown when I implement the loop -
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 2090, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: unknown option "-use"
I've scrutinised the code pretty carefully and can't see any differences so I'm not entirely sure what it means or why its comes up? or why the same thing doesn't happen in the video, any ideas?