How to access a variable within a class? - Python - Tkinter windows











up vote
0
down vote

favorite












I am in need of help in solving this issue, I know is a long post but this issue is hitting me for a while, and I searched for hours for an answer without a solution.



I am developing a Tkinter software with some windows to the user to navigate through. Each window will have a set of questions to be answered and the objective is to save all those answers into a separate file. For easiness of maintenance, I developed each window in a different file so I can track back easier errors and changes to the windows themselves.



I don't believe the issue lays with using Tkinter itself, but I am inserting all the code (1 window creation and 2 classes for defining the questionnaires) so it is a valid running code.



If I isolate one questionnaire and create a window = tk.Tk() to test it, I can use de variable, but with the presented architecture no.



My window creation code is:



import tkinter as tk, Questions1 as q1, Questions2 as q2

#Software initial_class
class HAS(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, *kwargs)
#Page configure
tk.Tk.wm_title(self, "Checklist")
container = tk.Frame(self)
container.pack(side="top", fill="both", expand=True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
container.configure(background = "white")

#Adding overhead menu
menubar = tk.Menu(container)
filemenu = tk.Menu(menubar, tearoff = 0)
filemenu.add_command(label = "Save", command = print("In development"))
filemenu.add_command(label = "Exit", command= self.destroy)
menubar.add_cascade(label="File", menu=filemenu)
tk.Tk.config(self, menu=menubar)

#Defining the page_frames
self.frames = {}
for F in (q1.Q1, q2.Q2):
frame = F(container, self)
self.frames[F] = frame
frame.grid(row=0, column=0, sticky="nsew")
self.show_frame(q1.Q1)

#showing the selected frame
def show_frame(self, cont):
frame = self.frames[cont]
frame.tkraise()


app = HAS()
app.geometry("530x700")
app.mainloop()


My First Questionaire page is:



import tkinter as tk
from tkinter import ttk

FONT = ("Arial", 11)
choices_y_n = ['-', 'Yes', 'No']
Questionlist_a = ["A. Is true?:", "B. Is True? :","C. Is True? :", "D. True? :"]


def save_values():
global y
y = list(map(lambda x: x.get(), qt))
print(y)


class Q1(tk.Frame):

def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.columnconfigure(0, minsize=100)
self.columnconfigure(1, minsize=150)
self.columnconfigure(2, minsize=50)

#Header Config
tk.Frame.configure(self, background = "white")
#tk.Label(self, image=Logo, background="white").grid(row=0, column=0, padx=100, columnspan=3, pady=10, sticky="W")
ttk.Label(self, text="1st Checklist", font = FONT, background = "white").grid(row=1, column=0, columnspan=3, pady = 10)
ttk.Label(self, text="Questions: ", background="white").grid(row=2, column=0,columnspan=2, padx=10, pady = 10, sticky="W")

#Questions
global qt
qt = [tk.StringVar(self) for i in range(len(Questionlist_a))]
for r in range(len(Questionlist_a)):
ttk.Label(self, text=Questionlist_a[r], background = "white").grid(row= r+3, column=0, columnspan=2, padx=10, pady = 10, sticky="W")
ttk.OptionMenu(self, qt[r], *choices_y_n).grid(row = r+3, column=2, padx=10, sticky="WE")
r=+1

#Buttons
ttk.Button(self, text="Save values", command = save_values, width=18).grid(row=16, column=0, padx=10, pady=15, sticky="W")
ttk.Button(self, text="Questions 2", command = lambda: controller.show_frame(__import__('Questions2').Q2),width=18).grid(row=17, column=0, padx=10, pady=15, sticky="W")


and my 2nd questionaire is:



import tkinter as tk
from tkinter import ttk

FONT = ("Arial", 11)
choices_y_n = ['-', 'Yes', 'No']
Questionlist_b = ["E. Is true?:", "F. Is True? :","G. Is True? :", "H. True? :"]


def save_values():
global y
y = list(map(lambda x: x.get(), qt))
print(y)


class Q2(tk.Frame):

def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.columnconfigure(0, minsize=100)
self.columnconfigure(1, minsize=150)
self.columnconfigure(2, minsize=50)

#Header Config
tk.Frame.configure(self, background = "white")

ttk.Label(self, text="2nd Checklist", font = FONT, background = "white").grid(row=1, column=0, columnspan=3, pady = 10)
ttk.Label(self, text="Questions: ", background="white").grid(row=2, column=0,columnspan=2, padx=10, pady = 10, sticky="W")

#Questions
global qt
qt = [tk.StringVar(self) for i in range(len(Questionlist_b))]
for r in range(len(Questionlist_b)):
ttk.Label(self, text=Questionlist_b[r], background = "white").grid(row= r+3, column=0, columnspan=2, padx=10, pady = 10, sticky="W")
ttk.OptionMenu(self, qt[r], *choices_y_n).grid(row = r+3, column=2, padx=10, sticky="WE")
r=+1

#Buttons
ttk.Button(self, text="Save values", command = save_values, width=18).grid(row=16, column=0, padx=10, pady=15, sticky="W")
ttk.Button(self, text="Questions 1", command = lambda: controller.show_frame(__import__('Questions1').Q1),width=18).grid(row=17, column=0, padx=10, pady=15, sticky="W")


This code is able to print the answers from the save_values functions but I can't find a way to save those lists in a dictionary or a list of lists.



Can anyone help me with it?



Thanks alot!










share|improve this question




























    up vote
    0
    down vote

    favorite












    I am in need of help in solving this issue, I know is a long post but this issue is hitting me for a while, and I searched for hours for an answer without a solution.



    I am developing a Tkinter software with some windows to the user to navigate through. Each window will have a set of questions to be answered and the objective is to save all those answers into a separate file. For easiness of maintenance, I developed each window in a different file so I can track back easier errors and changes to the windows themselves.



    I don't believe the issue lays with using Tkinter itself, but I am inserting all the code (1 window creation and 2 classes for defining the questionnaires) so it is a valid running code.



    If I isolate one questionnaire and create a window = tk.Tk() to test it, I can use de variable, but with the presented architecture no.



    My window creation code is:



    import tkinter as tk, Questions1 as q1, Questions2 as q2

    #Software initial_class
    class HAS(tk.Tk):
    def __init__(self, *args, **kwargs):
    tk.Tk.__init__(self, *args, *kwargs)
    #Page configure
    tk.Tk.wm_title(self, "Checklist")
    container = tk.Frame(self)
    container.pack(side="top", fill="both", expand=True)
    container.grid_rowconfigure(0, weight=1)
    container.grid_columnconfigure(0, weight=1)
    container.configure(background = "white")

    #Adding overhead menu
    menubar = tk.Menu(container)
    filemenu = tk.Menu(menubar, tearoff = 0)
    filemenu.add_command(label = "Save", command = print("In development"))
    filemenu.add_command(label = "Exit", command= self.destroy)
    menubar.add_cascade(label="File", menu=filemenu)
    tk.Tk.config(self, menu=menubar)

    #Defining the page_frames
    self.frames = {}
    for F in (q1.Q1, q2.Q2):
    frame = F(container, self)
    self.frames[F] = frame
    frame.grid(row=0, column=0, sticky="nsew")
    self.show_frame(q1.Q1)

    #showing the selected frame
    def show_frame(self, cont):
    frame = self.frames[cont]
    frame.tkraise()


    app = HAS()
    app.geometry("530x700")
    app.mainloop()


    My First Questionaire page is:



    import tkinter as tk
    from tkinter import ttk

    FONT = ("Arial", 11)
    choices_y_n = ['-', 'Yes', 'No']
    Questionlist_a = ["A. Is true?:", "B. Is True? :","C. Is True? :", "D. True? :"]


    def save_values():
    global y
    y = list(map(lambda x: x.get(), qt))
    print(y)


    class Q1(tk.Frame):

    def __init__(self, parent, controller):
    tk.Frame.__init__(self, parent)
    self.columnconfigure(0, minsize=100)
    self.columnconfigure(1, minsize=150)
    self.columnconfigure(2, minsize=50)

    #Header Config
    tk.Frame.configure(self, background = "white")
    #tk.Label(self, image=Logo, background="white").grid(row=0, column=0, padx=100, columnspan=3, pady=10, sticky="W")
    ttk.Label(self, text="1st Checklist", font = FONT, background = "white").grid(row=1, column=0, columnspan=3, pady = 10)
    ttk.Label(self, text="Questions: ", background="white").grid(row=2, column=0,columnspan=2, padx=10, pady = 10, sticky="W")

    #Questions
    global qt
    qt = [tk.StringVar(self) for i in range(len(Questionlist_a))]
    for r in range(len(Questionlist_a)):
    ttk.Label(self, text=Questionlist_a[r], background = "white").grid(row= r+3, column=0, columnspan=2, padx=10, pady = 10, sticky="W")
    ttk.OptionMenu(self, qt[r], *choices_y_n).grid(row = r+3, column=2, padx=10, sticky="WE")
    r=+1

    #Buttons
    ttk.Button(self, text="Save values", command = save_values, width=18).grid(row=16, column=0, padx=10, pady=15, sticky="W")
    ttk.Button(self, text="Questions 2", command = lambda: controller.show_frame(__import__('Questions2').Q2),width=18).grid(row=17, column=0, padx=10, pady=15, sticky="W")


    and my 2nd questionaire is:



    import tkinter as tk
    from tkinter import ttk

    FONT = ("Arial", 11)
    choices_y_n = ['-', 'Yes', 'No']
    Questionlist_b = ["E. Is true?:", "F. Is True? :","G. Is True? :", "H. True? :"]


    def save_values():
    global y
    y = list(map(lambda x: x.get(), qt))
    print(y)


    class Q2(tk.Frame):

    def __init__(self, parent, controller):
    tk.Frame.__init__(self, parent)
    self.columnconfigure(0, minsize=100)
    self.columnconfigure(1, minsize=150)
    self.columnconfigure(2, minsize=50)

    #Header Config
    tk.Frame.configure(self, background = "white")

    ttk.Label(self, text="2nd Checklist", font = FONT, background = "white").grid(row=1, column=0, columnspan=3, pady = 10)
    ttk.Label(self, text="Questions: ", background="white").grid(row=2, column=0,columnspan=2, padx=10, pady = 10, sticky="W")

    #Questions
    global qt
    qt = [tk.StringVar(self) for i in range(len(Questionlist_b))]
    for r in range(len(Questionlist_b)):
    ttk.Label(self, text=Questionlist_b[r], background = "white").grid(row= r+3, column=0, columnspan=2, padx=10, pady = 10, sticky="W")
    ttk.OptionMenu(self, qt[r], *choices_y_n).grid(row = r+3, column=2, padx=10, sticky="WE")
    r=+1

    #Buttons
    ttk.Button(self, text="Save values", command = save_values, width=18).grid(row=16, column=0, padx=10, pady=15, sticky="W")
    ttk.Button(self, text="Questions 1", command = lambda: controller.show_frame(__import__('Questions1').Q1),width=18).grid(row=17, column=0, padx=10, pady=15, sticky="W")


    This code is able to print the answers from the save_values functions but I can't find a way to save those lists in a dictionary or a list of lists.



    Can anyone help me with it?



    Thanks alot!










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am in need of help in solving this issue, I know is a long post but this issue is hitting me for a while, and I searched for hours for an answer without a solution.



      I am developing a Tkinter software with some windows to the user to navigate through. Each window will have a set of questions to be answered and the objective is to save all those answers into a separate file. For easiness of maintenance, I developed each window in a different file so I can track back easier errors and changes to the windows themselves.



      I don't believe the issue lays with using Tkinter itself, but I am inserting all the code (1 window creation and 2 classes for defining the questionnaires) so it is a valid running code.



      If I isolate one questionnaire and create a window = tk.Tk() to test it, I can use de variable, but with the presented architecture no.



      My window creation code is:



      import tkinter as tk, Questions1 as q1, Questions2 as q2

      #Software initial_class
      class HAS(tk.Tk):
      def __init__(self, *args, **kwargs):
      tk.Tk.__init__(self, *args, *kwargs)
      #Page configure
      tk.Tk.wm_title(self, "Checklist")
      container = tk.Frame(self)
      container.pack(side="top", fill="both", expand=True)
      container.grid_rowconfigure(0, weight=1)
      container.grid_columnconfigure(0, weight=1)
      container.configure(background = "white")

      #Adding overhead menu
      menubar = tk.Menu(container)
      filemenu = tk.Menu(menubar, tearoff = 0)
      filemenu.add_command(label = "Save", command = print("In development"))
      filemenu.add_command(label = "Exit", command= self.destroy)
      menubar.add_cascade(label="File", menu=filemenu)
      tk.Tk.config(self, menu=menubar)

      #Defining the page_frames
      self.frames = {}
      for F in (q1.Q1, q2.Q2):
      frame = F(container, self)
      self.frames[F] = frame
      frame.grid(row=0, column=0, sticky="nsew")
      self.show_frame(q1.Q1)

      #showing the selected frame
      def show_frame(self, cont):
      frame = self.frames[cont]
      frame.tkraise()


      app = HAS()
      app.geometry("530x700")
      app.mainloop()


      My First Questionaire page is:



      import tkinter as tk
      from tkinter import ttk

      FONT = ("Arial", 11)
      choices_y_n = ['-', 'Yes', 'No']
      Questionlist_a = ["A. Is true?:", "B. Is True? :","C. Is True? :", "D. True? :"]


      def save_values():
      global y
      y = list(map(lambda x: x.get(), qt))
      print(y)


      class Q1(tk.Frame):

      def __init__(self, parent, controller):
      tk.Frame.__init__(self, parent)
      self.columnconfigure(0, minsize=100)
      self.columnconfigure(1, minsize=150)
      self.columnconfigure(2, minsize=50)

      #Header Config
      tk.Frame.configure(self, background = "white")
      #tk.Label(self, image=Logo, background="white").grid(row=0, column=0, padx=100, columnspan=3, pady=10, sticky="W")
      ttk.Label(self, text="1st Checklist", font = FONT, background = "white").grid(row=1, column=0, columnspan=3, pady = 10)
      ttk.Label(self, text="Questions: ", background="white").grid(row=2, column=0,columnspan=2, padx=10, pady = 10, sticky="W")

      #Questions
      global qt
      qt = [tk.StringVar(self) for i in range(len(Questionlist_a))]
      for r in range(len(Questionlist_a)):
      ttk.Label(self, text=Questionlist_a[r], background = "white").grid(row= r+3, column=0, columnspan=2, padx=10, pady = 10, sticky="W")
      ttk.OptionMenu(self, qt[r], *choices_y_n).grid(row = r+3, column=2, padx=10, sticky="WE")
      r=+1

      #Buttons
      ttk.Button(self, text="Save values", command = save_values, width=18).grid(row=16, column=0, padx=10, pady=15, sticky="W")
      ttk.Button(self, text="Questions 2", command = lambda: controller.show_frame(__import__('Questions2').Q2),width=18).grid(row=17, column=0, padx=10, pady=15, sticky="W")


      and my 2nd questionaire is:



      import tkinter as tk
      from tkinter import ttk

      FONT = ("Arial", 11)
      choices_y_n = ['-', 'Yes', 'No']
      Questionlist_b = ["E. Is true?:", "F. Is True? :","G. Is True? :", "H. True? :"]


      def save_values():
      global y
      y = list(map(lambda x: x.get(), qt))
      print(y)


      class Q2(tk.Frame):

      def __init__(self, parent, controller):
      tk.Frame.__init__(self, parent)
      self.columnconfigure(0, minsize=100)
      self.columnconfigure(1, minsize=150)
      self.columnconfigure(2, minsize=50)

      #Header Config
      tk.Frame.configure(self, background = "white")

      ttk.Label(self, text="2nd Checklist", font = FONT, background = "white").grid(row=1, column=0, columnspan=3, pady = 10)
      ttk.Label(self, text="Questions: ", background="white").grid(row=2, column=0,columnspan=2, padx=10, pady = 10, sticky="W")

      #Questions
      global qt
      qt = [tk.StringVar(self) for i in range(len(Questionlist_b))]
      for r in range(len(Questionlist_b)):
      ttk.Label(self, text=Questionlist_b[r], background = "white").grid(row= r+3, column=0, columnspan=2, padx=10, pady = 10, sticky="W")
      ttk.OptionMenu(self, qt[r], *choices_y_n).grid(row = r+3, column=2, padx=10, sticky="WE")
      r=+1

      #Buttons
      ttk.Button(self, text="Save values", command = save_values, width=18).grid(row=16, column=0, padx=10, pady=15, sticky="W")
      ttk.Button(self, text="Questions 1", command = lambda: controller.show_frame(__import__('Questions1').Q1),width=18).grid(row=17, column=0, padx=10, pady=15, sticky="W")


      This code is able to print the answers from the save_values functions but I can't find a way to save those lists in a dictionary or a list of lists.



      Can anyone help me with it?



      Thanks alot!










      share|improve this question















      I am in need of help in solving this issue, I know is a long post but this issue is hitting me for a while, and I searched for hours for an answer without a solution.



      I am developing a Tkinter software with some windows to the user to navigate through. Each window will have a set of questions to be answered and the objective is to save all those answers into a separate file. For easiness of maintenance, I developed each window in a different file so I can track back easier errors and changes to the windows themselves.



      I don't believe the issue lays with using Tkinter itself, but I am inserting all the code (1 window creation and 2 classes for defining the questionnaires) so it is a valid running code.



      If I isolate one questionnaire and create a window = tk.Tk() to test it, I can use de variable, but with the presented architecture no.



      My window creation code is:



      import tkinter as tk, Questions1 as q1, Questions2 as q2

      #Software initial_class
      class HAS(tk.Tk):
      def __init__(self, *args, **kwargs):
      tk.Tk.__init__(self, *args, *kwargs)
      #Page configure
      tk.Tk.wm_title(self, "Checklist")
      container = tk.Frame(self)
      container.pack(side="top", fill="both", expand=True)
      container.grid_rowconfigure(0, weight=1)
      container.grid_columnconfigure(0, weight=1)
      container.configure(background = "white")

      #Adding overhead menu
      menubar = tk.Menu(container)
      filemenu = tk.Menu(menubar, tearoff = 0)
      filemenu.add_command(label = "Save", command = print("In development"))
      filemenu.add_command(label = "Exit", command= self.destroy)
      menubar.add_cascade(label="File", menu=filemenu)
      tk.Tk.config(self, menu=menubar)

      #Defining the page_frames
      self.frames = {}
      for F in (q1.Q1, q2.Q2):
      frame = F(container, self)
      self.frames[F] = frame
      frame.grid(row=0, column=0, sticky="nsew")
      self.show_frame(q1.Q1)

      #showing the selected frame
      def show_frame(self, cont):
      frame = self.frames[cont]
      frame.tkraise()


      app = HAS()
      app.geometry("530x700")
      app.mainloop()


      My First Questionaire page is:



      import tkinter as tk
      from tkinter import ttk

      FONT = ("Arial", 11)
      choices_y_n = ['-', 'Yes', 'No']
      Questionlist_a = ["A. Is true?:", "B. Is True? :","C. Is True? :", "D. True? :"]


      def save_values():
      global y
      y = list(map(lambda x: x.get(), qt))
      print(y)


      class Q1(tk.Frame):

      def __init__(self, parent, controller):
      tk.Frame.__init__(self, parent)
      self.columnconfigure(0, minsize=100)
      self.columnconfigure(1, minsize=150)
      self.columnconfigure(2, minsize=50)

      #Header Config
      tk.Frame.configure(self, background = "white")
      #tk.Label(self, image=Logo, background="white").grid(row=0, column=0, padx=100, columnspan=3, pady=10, sticky="W")
      ttk.Label(self, text="1st Checklist", font = FONT, background = "white").grid(row=1, column=0, columnspan=3, pady = 10)
      ttk.Label(self, text="Questions: ", background="white").grid(row=2, column=0,columnspan=2, padx=10, pady = 10, sticky="W")

      #Questions
      global qt
      qt = [tk.StringVar(self) for i in range(len(Questionlist_a))]
      for r in range(len(Questionlist_a)):
      ttk.Label(self, text=Questionlist_a[r], background = "white").grid(row= r+3, column=0, columnspan=2, padx=10, pady = 10, sticky="W")
      ttk.OptionMenu(self, qt[r], *choices_y_n).grid(row = r+3, column=2, padx=10, sticky="WE")
      r=+1

      #Buttons
      ttk.Button(self, text="Save values", command = save_values, width=18).grid(row=16, column=0, padx=10, pady=15, sticky="W")
      ttk.Button(self, text="Questions 2", command = lambda: controller.show_frame(__import__('Questions2').Q2),width=18).grid(row=17, column=0, padx=10, pady=15, sticky="W")


      and my 2nd questionaire is:



      import tkinter as tk
      from tkinter import ttk

      FONT = ("Arial", 11)
      choices_y_n = ['-', 'Yes', 'No']
      Questionlist_b = ["E. Is true?:", "F. Is True? :","G. Is True? :", "H. True? :"]


      def save_values():
      global y
      y = list(map(lambda x: x.get(), qt))
      print(y)


      class Q2(tk.Frame):

      def __init__(self, parent, controller):
      tk.Frame.__init__(self, parent)
      self.columnconfigure(0, minsize=100)
      self.columnconfigure(1, minsize=150)
      self.columnconfigure(2, minsize=50)

      #Header Config
      tk.Frame.configure(self, background = "white")

      ttk.Label(self, text="2nd Checklist", font = FONT, background = "white").grid(row=1, column=0, columnspan=3, pady = 10)
      ttk.Label(self, text="Questions: ", background="white").grid(row=2, column=0,columnspan=2, padx=10, pady = 10, sticky="W")

      #Questions
      global qt
      qt = [tk.StringVar(self) for i in range(len(Questionlist_b))]
      for r in range(len(Questionlist_b)):
      ttk.Label(self, text=Questionlist_b[r], background = "white").grid(row= r+3, column=0, columnspan=2, padx=10, pady = 10, sticky="W")
      ttk.OptionMenu(self, qt[r], *choices_y_n).grid(row = r+3, column=2, padx=10, sticky="WE")
      r=+1

      #Buttons
      ttk.Button(self, text="Save values", command = save_values, width=18).grid(row=16, column=0, padx=10, pady=15, sticky="W")
      ttk.Button(self, text="Questions 1", command = lambda: controller.show_frame(__import__('Questions1').Q1),width=18).grid(row=17, column=0, padx=10, pady=15, sticky="W")


      This code is able to print the answers from the save_values functions but I can't find a way to save those lists in a dictionary or a list of lists.



      Can anyone help me with it?



      Thanks alot!







      python-3.x list class variables tkinter






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 at 16:03









      Bryan Oakley

      211k21248410




      211k21248410










      asked Nov 22 at 14:54









      Rafael Castelo Branco

      395




      395
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          If I understood it correctly, you want to access the saved answers from the master window. To do so, first you have to make the function save_values a method of the Questions1 and Questions2 classes and create a property (I have named it self.list_answers) to store the answers.



          So, the first class code would be (questionnare two can be done the same way):



          import tkinter as tk
          from tkinter import ttk

          FONT = ("Arial", 11)
          choices_y_n = ['-', 'Yes', 'No']
          Questionlist_a = ["A. Is true?:", "B. Is True? :","C. Is True? :", "D. True? :"]


          class Q1(tk.Frame):
          def __init__(self, parent, controller):
          tk.Frame.__init__(self, parent)
          self.columnconfigure(0, minsize=100)
          self.columnconfigure(1, minsize=150)
          self.columnconfigure(2, minsize=50)

          #Header Config
          tk.Frame.configure(self, background = "white")
          #tk.Label(self, image=Logo, background="white").grid(row=0, column=0, padx=100, columnspan=3, pady=10, sticky="W")
          ttk.Label(self, text="1st Checklist", font = FONT, background = "white").grid(row=1, column=0, columnspan=3, pady = 10)
          ttk.Label(self, text="Questions: ", background="white").grid(row=2, column=0,columnspan=2, padx=10, pady = 10, sticky="W")

          #Questions
          global qt
          qt = [tk.StringVar(self) for i in range(len(Questionlist_a))]
          for r in range(len(Questionlist_a)):
          ttk.Label(self, text=Questionlist_a[r], background = "white").grid(row= r+3, column=0, columnspan=2, padx=10, pady = 10, sticky="W")
          ttk.OptionMenu(self, qt[r], *choices_y_n).grid(row = r+3, column=2, padx=10, sticky="WE")
          r=+1

          #Buttons
          ttk.Button(self, text="Save values", command = self.save_values, width=18).grid(row=16, column=0, padx=10, pady=15, sticky="W")
          ttk.Button(self, text="Questions 2", command = lambda: controller.show_frame(__import__('Questions2').Q2),width=18).grid(row=17, column=0, padx=10, pady=15, sticky="W")

          # List of answers
          self.list_answers=

          def save_values(self):
          self.list_answers = list(map(lambda x: x.get(), qt))


          Then, you could access list_answers outside the class. For instance, I have used the "Save" button of the filemenu to make a dictionary of the answers of both questionnares and print it with the following function:



              # Function accessing the list of answers
          def saveList(self):
          dict_answers={'Answers 1': self.frames[q1.Q1].list_answers, "Answers 2": self.frames[q2.Q2].list_answers}
          print(dict_answers)


          Then, the complete code of the main window is left as follows:



          import tkinter as tk, Questions1 as q1, Questions2 as q2

          #Software initial_class
          class HAS(tk.Tk):
          def __init__(self, *args, **kwargs):
          tk.Tk.__init__(self, *args, *kwargs)
          #Page configure
          tk.Tk.wm_title(self, "Checklist")
          container = tk.Frame(self)
          container.pack(side="top", fill="both", expand=True)
          container.grid_rowconfigure(0, weight=1)
          container.grid_columnconfigure(0, weight=1)
          container.configure(background = "white")

          #Adding overhead menu
          menubar = tk.Menu(container)
          filemenu = tk.Menu(menubar, tearoff = 0)
          filemenu.add_command(label = "Save", command = self.saveList)
          filemenu.add_command(label = "Exit", command= self.destroy)
          menubar.add_cascade(label="File", menu=filemenu)
          tk.Tk.config(self, menu=menubar)

          #Defining the page_frames
          self.frames = {}
          for F in (q1.Q1, q2.Q2):
          frame = F(container, self)
          self.frames[F] = frame
          frame.grid(row=0, column=0, sticky="nsew")
          self.show_frame(q1.Q1)

          #showing the selected frame
          def show_frame(self, cont):
          frame = self.frames[cont]
          frame.tkraise()

          # Function accessing the list of answers
          def saveList(self):
          dict_answers={'Answers 1': self.frames[q1.Q1].list_answers, "Answers 2": self.frames[q2.Q2].list_answers}
          print(dict_answers)


          app = HAS()
          app.geometry("530x700")
          app.mainloop()


          Then, you can save the answers that each questionnare has at each moment by pressing "Save" in the file menu. As an example, I have pressed "Save" before filling any questionnare, after having filled the first and, finally, after having filled the second one:



          enter image description here






          share|improve this answer























          • That worked greatly! Thank alot for all the help! I also was reading that this issue is related to init variables not being shared on the class, and it is exactly what you presented.
            – Rafael Castelo Branco
            Nov 27 at 14:29










          • You are welcome. I am glad it has solved your problem! Please consider accepting the answer so that the question can be closed
            – David Duran
            Nov 27 at 15:17











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53433564%2fhow-to-access-a-variable-within-a-class-python-tkinter-windows%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          If I understood it correctly, you want to access the saved answers from the master window. To do so, first you have to make the function save_values a method of the Questions1 and Questions2 classes and create a property (I have named it self.list_answers) to store the answers.



          So, the first class code would be (questionnare two can be done the same way):



          import tkinter as tk
          from tkinter import ttk

          FONT = ("Arial", 11)
          choices_y_n = ['-', 'Yes', 'No']
          Questionlist_a = ["A. Is true?:", "B. Is True? :","C. Is True? :", "D. True? :"]


          class Q1(tk.Frame):
          def __init__(self, parent, controller):
          tk.Frame.__init__(self, parent)
          self.columnconfigure(0, minsize=100)
          self.columnconfigure(1, minsize=150)
          self.columnconfigure(2, minsize=50)

          #Header Config
          tk.Frame.configure(self, background = "white")
          #tk.Label(self, image=Logo, background="white").grid(row=0, column=0, padx=100, columnspan=3, pady=10, sticky="W")
          ttk.Label(self, text="1st Checklist", font = FONT, background = "white").grid(row=1, column=0, columnspan=3, pady = 10)
          ttk.Label(self, text="Questions: ", background="white").grid(row=2, column=0,columnspan=2, padx=10, pady = 10, sticky="W")

          #Questions
          global qt
          qt = [tk.StringVar(self) for i in range(len(Questionlist_a))]
          for r in range(len(Questionlist_a)):
          ttk.Label(self, text=Questionlist_a[r], background = "white").grid(row= r+3, column=0, columnspan=2, padx=10, pady = 10, sticky="W")
          ttk.OptionMenu(self, qt[r], *choices_y_n).grid(row = r+3, column=2, padx=10, sticky="WE")
          r=+1

          #Buttons
          ttk.Button(self, text="Save values", command = self.save_values, width=18).grid(row=16, column=0, padx=10, pady=15, sticky="W")
          ttk.Button(self, text="Questions 2", command = lambda: controller.show_frame(__import__('Questions2').Q2),width=18).grid(row=17, column=0, padx=10, pady=15, sticky="W")

          # List of answers
          self.list_answers=

          def save_values(self):
          self.list_answers = list(map(lambda x: x.get(), qt))


          Then, you could access list_answers outside the class. For instance, I have used the "Save" button of the filemenu to make a dictionary of the answers of both questionnares and print it with the following function:



              # Function accessing the list of answers
          def saveList(self):
          dict_answers={'Answers 1': self.frames[q1.Q1].list_answers, "Answers 2": self.frames[q2.Q2].list_answers}
          print(dict_answers)


          Then, the complete code of the main window is left as follows:



          import tkinter as tk, Questions1 as q1, Questions2 as q2

          #Software initial_class
          class HAS(tk.Tk):
          def __init__(self, *args, **kwargs):
          tk.Tk.__init__(self, *args, *kwargs)
          #Page configure
          tk.Tk.wm_title(self, "Checklist")
          container = tk.Frame(self)
          container.pack(side="top", fill="both", expand=True)
          container.grid_rowconfigure(0, weight=1)
          container.grid_columnconfigure(0, weight=1)
          container.configure(background = "white")

          #Adding overhead menu
          menubar = tk.Menu(container)
          filemenu = tk.Menu(menubar, tearoff = 0)
          filemenu.add_command(label = "Save", command = self.saveList)
          filemenu.add_command(label = "Exit", command= self.destroy)
          menubar.add_cascade(label="File", menu=filemenu)
          tk.Tk.config(self, menu=menubar)

          #Defining the page_frames
          self.frames = {}
          for F in (q1.Q1, q2.Q2):
          frame = F(container, self)
          self.frames[F] = frame
          frame.grid(row=0, column=0, sticky="nsew")
          self.show_frame(q1.Q1)

          #showing the selected frame
          def show_frame(self, cont):
          frame = self.frames[cont]
          frame.tkraise()

          # Function accessing the list of answers
          def saveList(self):
          dict_answers={'Answers 1': self.frames[q1.Q1].list_answers, "Answers 2": self.frames[q2.Q2].list_answers}
          print(dict_answers)


          app = HAS()
          app.geometry("530x700")
          app.mainloop()


          Then, you can save the answers that each questionnare has at each moment by pressing "Save" in the file menu. As an example, I have pressed "Save" before filling any questionnare, after having filled the first and, finally, after having filled the second one:



          enter image description here






          share|improve this answer























          • That worked greatly! Thank alot for all the help! I also was reading that this issue is related to init variables not being shared on the class, and it is exactly what you presented.
            – Rafael Castelo Branco
            Nov 27 at 14:29










          • You are welcome. I am glad it has solved your problem! Please consider accepting the answer so that the question can be closed
            – David Duran
            Nov 27 at 15:17















          up vote
          1
          down vote



          accepted










          If I understood it correctly, you want to access the saved answers from the master window. To do so, first you have to make the function save_values a method of the Questions1 and Questions2 classes and create a property (I have named it self.list_answers) to store the answers.



          So, the first class code would be (questionnare two can be done the same way):



          import tkinter as tk
          from tkinter import ttk

          FONT = ("Arial", 11)
          choices_y_n = ['-', 'Yes', 'No']
          Questionlist_a = ["A. Is true?:", "B. Is True? :","C. Is True? :", "D. True? :"]


          class Q1(tk.Frame):
          def __init__(self, parent, controller):
          tk.Frame.__init__(self, parent)
          self.columnconfigure(0, minsize=100)
          self.columnconfigure(1, minsize=150)
          self.columnconfigure(2, minsize=50)

          #Header Config
          tk.Frame.configure(self, background = "white")
          #tk.Label(self, image=Logo, background="white").grid(row=0, column=0, padx=100, columnspan=3, pady=10, sticky="W")
          ttk.Label(self, text="1st Checklist", font = FONT, background = "white").grid(row=1, column=0, columnspan=3, pady = 10)
          ttk.Label(self, text="Questions: ", background="white").grid(row=2, column=0,columnspan=2, padx=10, pady = 10, sticky="W")

          #Questions
          global qt
          qt = [tk.StringVar(self) for i in range(len(Questionlist_a))]
          for r in range(len(Questionlist_a)):
          ttk.Label(self, text=Questionlist_a[r], background = "white").grid(row= r+3, column=0, columnspan=2, padx=10, pady = 10, sticky="W")
          ttk.OptionMenu(self, qt[r], *choices_y_n).grid(row = r+3, column=2, padx=10, sticky="WE")
          r=+1

          #Buttons
          ttk.Button(self, text="Save values", command = self.save_values, width=18).grid(row=16, column=0, padx=10, pady=15, sticky="W")
          ttk.Button(self, text="Questions 2", command = lambda: controller.show_frame(__import__('Questions2').Q2),width=18).grid(row=17, column=0, padx=10, pady=15, sticky="W")

          # List of answers
          self.list_answers=

          def save_values(self):
          self.list_answers = list(map(lambda x: x.get(), qt))


          Then, you could access list_answers outside the class. For instance, I have used the "Save" button of the filemenu to make a dictionary of the answers of both questionnares and print it with the following function:



              # Function accessing the list of answers
          def saveList(self):
          dict_answers={'Answers 1': self.frames[q1.Q1].list_answers, "Answers 2": self.frames[q2.Q2].list_answers}
          print(dict_answers)


          Then, the complete code of the main window is left as follows:



          import tkinter as tk, Questions1 as q1, Questions2 as q2

          #Software initial_class
          class HAS(tk.Tk):
          def __init__(self, *args, **kwargs):
          tk.Tk.__init__(self, *args, *kwargs)
          #Page configure
          tk.Tk.wm_title(self, "Checklist")
          container = tk.Frame(self)
          container.pack(side="top", fill="both", expand=True)
          container.grid_rowconfigure(0, weight=1)
          container.grid_columnconfigure(0, weight=1)
          container.configure(background = "white")

          #Adding overhead menu
          menubar = tk.Menu(container)
          filemenu = tk.Menu(menubar, tearoff = 0)
          filemenu.add_command(label = "Save", command = self.saveList)
          filemenu.add_command(label = "Exit", command= self.destroy)
          menubar.add_cascade(label="File", menu=filemenu)
          tk.Tk.config(self, menu=menubar)

          #Defining the page_frames
          self.frames = {}
          for F in (q1.Q1, q2.Q2):
          frame = F(container, self)
          self.frames[F] = frame
          frame.grid(row=0, column=0, sticky="nsew")
          self.show_frame(q1.Q1)

          #showing the selected frame
          def show_frame(self, cont):
          frame = self.frames[cont]
          frame.tkraise()

          # Function accessing the list of answers
          def saveList(self):
          dict_answers={'Answers 1': self.frames[q1.Q1].list_answers, "Answers 2": self.frames[q2.Q2].list_answers}
          print(dict_answers)


          app = HAS()
          app.geometry("530x700")
          app.mainloop()


          Then, you can save the answers that each questionnare has at each moment by pressing "Save" in the file menu. As an example, I have pressed "Save" before filling any questionnare, after having filled the first and, finally, after having filled the second one:



          enter image description here






          share|improve this answer























          • That worked greatly! Thank alot for all the help! I also was reading that this issue is related to init variables not being shared on the class, and it is exactly what you presented.
            – Rafael Castelo Branco
            Nov 27 at 14:29










          • You are welcome. I am glad it has solved your problem! Please consider accepting the answer so that the question can be closed
            – David Duran
            Nov 27 at 15:17













          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          If I understood it correctly, you want to access the saved answers from the master window. To do so, first you have to make the function save_values a method of the Questions1 and Questions2 classes and create a property (I have named it self.list_answers) to store the answers.



          So, the first class code would be (questionnare two can be done the same way):



          import tkinter as tk
          from tkinter import ttk

          FONT = ("Arial", 11)
          choices_y_n = ['-', 'Yes', 'No']
          Questionlist_a = ["A. Is true?:", "B. Is True? :","C. Is True? :", "D. True? :"]


          class Q1(tk.Frame):
          def __init__(self, parent, controller):
          tk.Frame.__init__(self, parent)
          self.columnconfigure(0, minsize=100)
          self.columnconfigure(1, minsize=150)
          self.columnconfigure(2, minsize=50)

          #Header Config
          tk.Frame.configure(self, background = "white")
          #tk.Label(self, image=Logo, background="white").grid(row=0, column=0, padx=100, columnspan=3, pady=10, sticky="W")
          ttk.Label(self, text="1st Checklist", font = FONT, background = "white").grid(row=1, column=0, columnspan=3, pady = 10)
          ttk.Label(self, text="Questions: ", background="white").grid(row=2, column=0,columnspan=2, padx=10, pady = 10, sticky="W")

          #Questions
          global qt
          qt = [tk.StringVar(self) for i in range(len(Questionlist_a))]
          for r in range(len(Questionlist_a)):
          ttk.Label(self, text=Questionlist_a[r], background = "white").grid(row= r+3, column=0, columnspan=2, padx=10, pady = 10, sticky="W")
          ttk.OptionMenu(self, qt[r], *choices_y_n).grid(row = r+3, column=2, padx=10, sticky="WE")
          r=+1

          #Buttons
          ttk.Button(self, text="Save values", command = self.save_values, width=18).grid(row=16, column=0, padx=10, pady=15, sticky="W")
          ttk.Button(self, text="Questions 2", command = lambda: controller.show_frame(__import__('Questions2').Q2),width=18).grid(row=17, column=0, padx=10, pady=15, sticky="W")

          # List of answers
          self.list_answers=

          def save_values(self):
          self.list_answers = list(map(lambda x: x.get(), qt))


          Then, you could access list_answers outside the class. For instance, I have used the "Save" button of the filemenu to make a dictionary of the answers of both questionnares and print it with the following function:



              # Function accessing the list of answers
          def saveList(self):
          dict_answers={'Answers 1': self.frames[q1.Q1].list_answers, "Answers 2": self.frames[q2.Q2].list_answers}
          print(dict_answers)


          Then, the complete code of the main window is left as follows:



          import tkinter as tk, Questions1 as q1, Questions2 as q2

          #Software initial_class
          class HAS(tk.Tk):
          def __init__(self, *args, **kwargs):
          tk.Tk.__init__(self, *args, *kwargs)
          #Page configure
          tk.Tk.wm_title(self, "Checklist")
          container = tk.Frame(self)
          container.pack(side="top", fill="both", expand=True)
          container.grid_rowconfigure(0, weight=1)
          container.grid_columnconfigure(0, weight=1)
          container.configure(background = "white")

          #Adding overhead menu
          menubar = tk.Menu(container)
          filemenu = tk.Menu(menubar, tearoff = 0)
          filemenu.add_command(label = "Save", command = self.saveList)
          filemenu.add_command(label = "Exit", command= self.destroy)
          menubar.add_cascade(label="File", menu=filemenu)
          tk.Tk.config(self, menu=menubar)

          #Defining the page_frames
          self.frames = {}
          for F in (q1.Q1, q2.Q2):
          frame = F(container, self)
          self.frames[F] = frame
          frame.grid(row=0, column=0, sticky="nsew")
          self.show_frame(q1.Q1)

          #showing the selected frame
          def show_frame(self, cont):
          frame = self.frames[cont]
          frame.tkraise()

          # Function accessing the list of answers
          def saveList(self):
          dict_answers={'Answers 1': self.frames[q1.Q1].list_answers, "Answers 2": self.frames[q2.Q2].list_answers}
          print(dict_answers)


          app = HAS()
          app.geometry("530x700")
          app.mainloop()


          Then, you can save the answers that each questionnare has at each moment by pressing "Save" in the file menu. As an example, I have pressed "Save" before filling any questionnare, after having filled the first and, finally, after having filled the second one:



          enter image description here






          share|improve this answer














          If I understood it correctly, you want to access the saved answers from the master window. To do so, first you have to make the function save_values a method of the Questions1 and Questions2 classes and create a property (I have named it self.list_answers) to store the answers.



          So, the first class code would be (questionnare two can be done the same way):



          import tkinter as tk
          from tkinter import ttk

          FONT = ("Arial", 11)
          choices_y_n = ['-', 'Yes', 'No']
          Questionlist_a = ["A. Is true?:", "B. Is True? :","C. Is True? :", "D. True? :"]


          class Q1(tk.Frame):
          def __init__(self, parent, controller):
          tk.Frame.__init__(self, parent)
          self.columnconfigure(0, minsize=100)
          self.columnconfigure(1, minsize=150)
          self.columnconfigure(2, minsize=50)

          #Header Config
          tk.Frame.configure(self, background = "white")
          #tk.Label(self, image=Logo, background="white").grid(row=0, column=0, padx=100, columnspan=3, pady=10, sticky="W")
          ttk.Label(self, text="1st Checklist", font = FONT, background = "white").grid(row=1, column=0, columnspan=3, pady = 10)
          ttk.Label(self, text="Questions: ", background="white").grid(row=2, column=0,columnspan=2, padx=10, pady = 10, sticky="W")

          #Questions
          global qt
          qt = [tk.StringVar(self) for i in range(len(Questionlist_a))]
          for r in range(len(Questionlist_a)):
          ttk.Label(self, text=Questionlist_a[r], background = "white").grid(row= r+3, column=0, columnspan=2, padx=10, pady = 10, sticky="W")
          ttk.OptionMenu(self, qt[r], *choices_y_n).grid(row = r+3, column=2, padx=10, sticky="WE")
          r=+1

          #Buttons
          ttk.Button(self, text="Save values", command = self.save_values, width=18).grid(row=16, column=0, padx=10, pady=15, sticky="W")
          ttk.Button(self, text="Questions 2", command = lambda: controller.show_frame(__import__('Questions2').Q2),width=18).grid(row=17, column=0, padx=10, pady=15, sticky="W")

          # List of answers
          self.list_answers=

          def save_values(self):
          self.list_answers = list(map(lambda x: x.get(), qt))


          Then, you could access list_answers outside the class. For instance, I have used the "Save" button of the filemenu to make a dictionary of the answers of both questionnares and print it with the following function:



              # Function accessing the list of answers
          def saveList(self):
          dict_answers={'Answers 1': self.frames[q1.Q1].list_answers, "Answers 2": self.frames[q2.Q2].list_answers}
          print(dict_answers)


          Then, the complete code of the main window is left as follows:



          import tkinter as tk, Questions1 as q1, Questions2 as q2

          #Software initial_class
          class HAS(tk.Tk):
          def __init__(self, *args, **kwargs):
          tk.Tk.__init__(self, *args, *kwargs)
          #Page configure
          tk.Tk.wm_title(self, "Checklist")
          container = tk.Frame(self)
          container.pack(side="top", fill="both", expand=True)
          container.grid_rowconfigure(0, weight=1)
          container.grid_columnconfigure(0, weight=1)
          container.configure(background = "white")

          #Adding overhead menu
          menubar = tk.Menu(container)
          filemenu = tk.Menu(menubar, tearoff = 0)
          filemenu.add_command(label = "Save", command = self.saveList)
          filemenu.add_command(label = "Exit", command= self.destroy)
          menubar.add_cascade(label="File", menu=filemenu)
          tk.Tk.config(self, menu=menubar)

          #Defining the page_frames
          self.frames = {}
          for F in (q1.Q1, q2.Q2):
          frame = F(container, self)
          self.frames[F] = frame
          frame.grid(row=0, column=0, sticky="nsew")
          self.show_frame(q1.Q1)

          #showing the selected frame
          def show_frame(self, cont):
          frame = self.frames[cont]
          frame.tkraise()

          # Function accessing the list of answers
          def saveList(self):
          dict_answers={'Answers 1': self.frames[q1.Q1].list_answers, "Answers 2": self.frames[q2.Q2].list_answers}
          print(dict_answers)


          app = HAS()
          app.geometry("530x700")
          app.mainloop()


          Then, you can save the answers that each questionnare has at each moment by pressing "Save" in the file menu. As an example, I have pressed "Save" before filling any questionnare, after having filled the first and, finally, after having filled the second one:



          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 24 at 18:25

























          answered Nov 24 at 18:18









          David Duran

          536824




          536824












          • That worked greatly! Thank alot for all the help! I also was reading that this issue is related to init variables not being shared on the class, and it is exactly what you presented.
            – Rafael Castelo Branco
            Nov 27 at 14:29










          • You are welcome. I am glad it has solved your problem! Please consider accepting the answer so that the question can be closed
            – David Duran
            Nov 27 at 15:17


















          • That worked greatly! Thank alot for all the help! I also was reading that this issue is related to init variables not being shared on the class, and it is exactly what you presented.
            – Rafael Castelo Branco
            Nov 27 at 14:29










          • You are welcome. I am glad it has solved your problem! Please consider accepting the answer so that the question can be closed
            – David Duran
            Nov 27 at 15:17
















          That worked greatly! Thank alot for all the help! I also was reading that this issue is related to init variables not being shared on the class, and it is exactly what you presented.
          – Rafael Castelo Branco
          Nov 27 at 14:29




          That worked greatly! Thank alot for all the help! I also was reading that this issue is related to init variables not being shared on the class, and it is exactly what you presented.
          – Rafael Castelo Branco
          Nov 27 at 14:29












          You are welcome. I am glad it has solved your problem! Please consider accepting the answer so that the question can be closed
          – David Duran
          Nov 27 at 15:17




          You are welcome. I am glad it has solved your problem! Please consider accepting the answer so that the question can be closed
          – David Duran
          Nov 27 at 15:17


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53433564%2fhow-to-access-a-variable-within-a-class-python-tkinter-windows%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          What visual should I use to simply compare current year value vs last year in Power BI desktop

          How to ignore python UserWarning in pytest?

          Alexandru Averescu