title: Tkinter pages updated from separate files
body: <p>Using the below code originally posted <a href="https://stackoverflow.com/questions/7546050/switch-between-two-frames-in-tkinter">here</a> how can i use a 4th module with the <code>PageList()</code> command and a new page class below it to display it in my <code>WindowHandler()</code> class? through other research i believe you would have to stop using <code>Windowhandler()</code> as an instance of the main application class.</p>
  
  <p>The goal of this is to have the stacked frames in different files while each file can update the <code>frames={}</code> list without any having to add it in the main class. a similar example is given <a href="https://stackoverflow.com/questions/39530107/tkinter-have-code-for-pages-in-separate-files">here</a> for different pages but the call to those pages must still be added within the main class.</p>
  
  <p>Nav.py</p>
  
  <pre><code>import tkinter as tk
  from Page import PageList
  import Mypages
  
  class Windowhandler(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)
  
          PageList("Page1", container, self, Mypages.PageOne)
          PageList("Page2", container, self, Mypages.PageTwo)
          self.show_frame("Page1")
  
      def show_frame(self, cont):
          frameref = PageList.frames[cont]
          print(frameref)
          frameref.tkraise()
  
  
  
  app = Windowhandler()
  app.mainloop()
  </code></pre>
  
  <p>Page.py</p>
  
  <pre><code>class PageList():
  frames = {}
  def __init__(self, name, parent, cont, ref):
      self.frames[name] = ref(parent=parent, controller=cont)
  </code></pre>
  
  <p>Mypages.py</p>
  
  <pre><code>    import tkinter as tk
  
      class PageOne(tk.Frame):
          def __init__(self, parent, controller):
              this = tk.Frame.__init__(self, parent)
              label = tk.Label(this, text="Welcome to Page 1")
              label.pack(pady=10, padx=10)
  
              button1 = tk.Button(this, text="Back to Home",
                          command=lambda: controller.show_frame("Page2"))
              button1.pack()
  
      class PageTwo(tk.Frame):
          def __init__(self, parent, controller):
              this = tk.Frame.__init__(self, parent)
              label = tk.Label(this, text="Welcome to Page 2")
              label.pack(pady=10, padx=10)
  
              button1 = tk.Button(this, text="Back to Home",
                          command=lambda: controller.show_frame("NewPage"))
              button1.pack()
  </code></pre>
  
  <p>Psuedo.py</p>
  
  <pre><code>import tkinter as tk
  import Nav
  
  PageList("NewPage", Nav.container, WindowHandler, NewPage)
  
  class NewPage(tk.Frame):
      def __init__(self, parent, controller):
          tk.Frame.__init__(self, parent)
          btn1 = Nav(self, text="A Button" command=lambda: Controller.show_frame("Page1"))
          btn1.pack(pady=(10, 4))
  </code></pre>