Multiple Dynamic OptionMenu using DataFrame in Python Tkinter GUI-PY_VAR21 Error
<p>I have been working on filtering the DataFrame rows so that I could arrive at a Single row with respect to different options chosen in OptionMenus in sequence.
I did try to store the selected variable from OptionMenu and when I printed it, I get </p>

<p>'PY_VAR21' </p>

<p>as output. </p>

<p>Can you kindly clarify me. I enclose my datafile where I am willing to have Multiple dynamic OptionMenus where selected value goes further to another class.</p>

<pre><code>from Tkinter import *
master = Tk()
class MyClass():

    def __init__(self):

        self.zero=data.Category.unique()     
        self.variable0=StringVar()        
        option_menu=OptionMenu(master,self.variable0,*self.zero)        
        option_menu.pack()        

x=MyClass()
aa=x.variable0
print aa
mainloop()
</code></pre>

<p>I have got thousands of values and categories in each column and thus I want to automate the Dynamic OptionMenu using the available DataFrame.</p>

<p>I have been trying with different approaches and am failing for many number of days.Thank you.<a href="http://i.stack.imgur.com/re2Ff.png" rel="nofollow">Datafile</a></p>

<p>see below for printing the variable outside the class after the loop has finished. </p>

<pre><code>from Tkinter import *

class GUI():


    def __init__(self, master):
        self.variable0 = StringVar()
        self.variable0.set('Option1')
        self.option = OptionMenu(master, self.variable0, 'Option1', 'Option2', 'Option3')
        self.option.pack()

        self.close = Button(master, text='Close', command=master.quit)
        self.close.pack(side=BOTTOM)

root = Tk()
x = GUI(root)
root.mainloop()

var = x.variable0
print var.get()
</code></pre>

python python-2.7 tkinter