How can I access the 'Entry' string in another function?

arvind arvind.mulay at gmail.com
Tue Jul 4 02:07:20 EDT 2006


hi all,
i've created the myclass instance and calles the "function second()".
i want to access the text entered in 'w' through Entry widget in
"function third()"
i am getting the 'fuction not having 'w' attribute error.
how to overcome it?


class myclass:
    senter='arvind'

    def __init__(self):
        return None

    def third(self):
        self.senter=self.w.get()
        print senter

    def second(self):
        top=Tk()
        frame=Frame(top)
        frame.master.title("second")

        strobj=StringVar()
        w=Entry(top)

        b1=Button(top,text='Next',command=self.third)

        w.grid()
        b1.grid()
        frame.grid()
        
        mainloop()




More information about the Python-list mailing list