title: Frame object has no attribute
body: <p>Part of a GUI program I'm building needs to be able to convert times given into seconds. The frame class in my GUI that does this is giving me some trouble. I created an instance variable of type combobox to hold the options for types of time period to convert. I bound the combobox selection to convert the input time into seconds. I want to tie entering values into the entry box to doing the same thing. I tried to call my conversion function in my validation command function for the entry box, but it's telling me that my frame object "PERIODIC" doesn't have an attribute "period_type". I'm confused because I named the combobox as an instance variable, and it should be accessible to everything in the class. "self.period_type" is right there in my init. Why can't I access this variable? Am I missing something painfully obvious?</p>
  
  <p>The Traceback I'm getting is:</p>
  
  <pre class="lang-none prettyprint-override"><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File "C:\Users\4D_User\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py", line 1883, in __call__
      return self.func(*args)
    File "C:/Users/PycharmProjects/LoggerProject/Scripts/ProblemExample.py", line 37, in ValidateTime
      self.convert_time(self.period_type.get())
  AttributeError: 'PERIODIC' object has no attribute 'period_type'&lt;
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>from tkinter import ttk
  import re
  
  root = tk.Tk()
  
  class PERIODIC(tk.Frame):
      def __init__(self, container, **kwargs):
          super().__init__(container, **kwargs)
          self.time_unconverted = tk.DoubleVar()
          self.time_converted = tk.DoubleVar()
          self.periodic_label = tk.Label(self, text="PERIODIC")
          self.periodic_label.grid(row=0, columnspan=2, sticky="NSEW")
          trigger_option_label = ttk.Label(self, text="Trigger Every: ")
          trigger_option_label.grid(row=1, column=0)
          vcmd = (self.register(self.ValidateTime), '%P')
          self.num_period = tk.Entry(self,textvariable=self.time_unconverted, validate="key", validatecommand=vcmd)
          self.num_period.grid(row=1, column=1)
          self.period_type = ttk.Combobox(self, values=["seconds", "minutes", "hours", "days"])
          self.period_type.bind("&lt;&lt;ComboboxSelected&gt;&gt;", lambda y: self.convert_time(self.period_type.get()))
          self.period_type.grid(row=1, column=2)
  
      def convert_time(self, type):
          if type == 'seconds':
              self.time_converted.set(self.time_unconverted.get())
          if type == 'minutes':
              self.time_converted.set(self.time_unconverted.get() * 60)
          if type == 'hours':
              self.time_converted.set(self.time_unconverted.get() * 3600)
          if type == 'days':
              self.time_converted.set(self.time_unconverted.get() * 86400)
  
  
      def ValidateTime(self, P):
          test = re.compile('^[0-9]{1,3}?\.?[0-9]?$')
          if test.match(P):
              self.convert_time(self.period_type.get())
              return True
          else:
              return False
  
  frame = PERIODIC(root)
  frame.grid(row=0,column=0)
  root.mainloop()
  </code></pre>