title: python tkinter creating a widget outside his frame
body: <p>I want to create a widget outside his frame, but I don't know what's his master.</p>
  
  <p>this is the structure.
  first I created the class of the root. and then 3 classes of frames.
  inside the class of the root I put a function. inside the function I created a text widget that should be located in the first one of the 3 frames</p>
  
  <p>I really don't get what I should write as the master of my text widget to locate it in the first frame.</p>
  
  <p>since I am a beginner if you have any advice I'd really appreciate.
  thanks for attention here's the code</p>
  
  <pre><code>import tkinter as tk
  from tkinter import ttk
  from PIL import Image, ImageTk
  import datetime
  
  LARGE_FONT = ("VERDANA", 12)
  
  
  #user's information manager(classes and method)
  
  
  
  class person:
      def __init__(self, name, birthday, sex):
          self.name = name
          self.birthday = birthday
          self.sex = sex
  
      def age(self, name, birthday):
          user = person(name, birthday, "male")
          today = datetime.date.today()
  
          print (today.year - self.birthday.year)
  
  
  
  
  #main windows
  
  class deathCalculatorapp(tk.Tk):
  
      def __init__(self, *args, **kwargs):
          tk.Tk.__init__(self, *args, **kwargs)
          tk.Tk.wm_title(self, "age calculator app")
  
  
  
  
          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, 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")
  
  
  # all methods here
  
      def show_frame(self, page_name):
          '''Show a frame for the given page name'''
          frame = self.frames[page_name]
          frame.tkraise()
  
  
      def calculate(self, name, birthday):
          user = person(name, birthday, "male")
          text_answer = tk.Text(master = , height=3, width=30)
          text_answer.grid(column=1, row=9)
          answear_text = ("{name} is {age} years    old".format(name=name_entry.get(), age=calculate()))
          text_answer.insert(tk.END, answear_text)
          print (user.age()
  
  
      #all of the frames
  
  class StartPage(tk.Frame):
  
      def __init__(self, parent, controller):
          tk.Frame.__init__(self, parent)
          self.controller = controller
  
  
  
      #Labels
  
      label = ttk.Label(self, text="deathcalculatorapp", font=LARGE_FONT)
      label.grid(column=1, row=0)
  
      first_label = ttk.Label(self, text = "insert your data")
      name_label= tk.Label(self, text = "name", bg="lightblue")
      year_label = tk.Label(self, text="year", bg ="lightblue", padx=9)
      month_label = tk.Label(self, text= "month", bg = "lightblue", padx=3)
      day_label = tk.Label(self, text ="day", bg= "lightblue", padx=11)
  
      first_label.grid(column=1, row=3)
      name_label.grid(column=0, row=4)
      year_label.grid(column=0, row =5)
      month_label.grid(column=0, row =6)
      day_label.grid(column=0, row = 7)
  
  
  
  
      #Entries
  
      name_entry = tk.Entry(self, text = "", bg = "lightblue")
      year_entry = tk.Entry(self,text = "", bg = "lightblue")
      month_entry = tk.Entry(self, text = "", bg= "lightblue")
      day_entry = tk.Entry(self, text= "", bg = "lightblue")
  
  
  
      name_entry.grid(column=1, row=4)
      year_entry.grid(column=1,row=5)
      month_entry.grid(column=1, row= 6)
      day_entry.grid(column=1, row=7)
  
  
  
      #Radiobutton about sex
  
      sexdatum = tk.IntVar()
      female= ttk.Radiobutton(self, text="female",variable= sexdatum, value="female")
      male=ttk.Radiobutton(self, text="male", variable= sexdatum, value="male")
      female.grid(column=2, row=4)
      male.grid(column=2, row=5)
  
  
  
  
  
      #Buttons
  
      calculate_button = ttk.Button(self, text="calculate your lifespawn",
                                    command=lambda: controller.age(name_entry.get(),datetime.date(int(year_entry.get()),int(month_entry.get()),int(day_entry.get()))))
      calculate_button.grid(column=1, row=8)
      button1 = ttk.Button(self, text="Go to Page One",
                           command=lambda: controller.show_frame("PageOne"))
      button2 = ttk.Button(self, text="Go to Page Two",
                           command=lambda: controller.show_frame("PageTwo"))
      button1.grid(column=0, row=0)
      button2.grid(column=0, row=1)
  
  
  
      #text
  
  
  
      #image
  
      image = Image.open(r"/"
                         r"Users/tommasomasaracchio/Documents/pythonfolder/kushina4.jpg")
      image.thumbnail((500,300), Image.ANTIALIAS)
      photo = ImageTk.PhotoImage(image)
  
      Photo_label= ttk.Label(self, image=photo)
      Photo_label.image = photo
      Photo_label.grid(row= 2, column = 1)
  
  
  
  
  
  
  class PageOne(tk.Frame):
  
  def __init__(self, parent, controller):
      tk.Frame.__init__(self, parent)
      self.controller = controller
      label = ttk.Label(self, text="This is page 1", font=LARGE_FONT)
      label.grid(column=0, row=0)
      button = ttk.Button(self, text="Go to the start page",
                         command=lambda: controller.show_frame("StartPage"))
      button.grid(column=0, row=0)
  
  
  class PageTwo(tk.Frame):
  
  def __init__(self, parent, controller):
      tk.Frame.__init__(self, parent)
      self.controller = controller
      label = ttk.Label(self, text="This is page 2", font=LARGE_FONT)
      label.grid(column=0, row=0)
      button = ttk.Button(self, text="Go to the start page",
                         command=lambda:       controller.show_frame("StartPage"))
          button.grid(column=0, row=0)
  
  
  
  
  
  
  if __name__ == "__main__":
      app = deathCalculatorapp()
      app.mainloop()
  </code></pre>