In <[EMAIL PROTECTED]>, arvind wrote: > 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?
Make `w` an attribute of the object. When you create the widget in `second()` you just bind it to the local name `w` instead of `self.w`. You made a similar mistake when printing `senter` in `third()`. This time it's the other way around: you are trying to print a non-existing local `senter` instead of `self.senter`. This works: import Tkinter as tk class MyClass: senter = 'arvind' def third(self): self.senter = self.w.get() print self.senter def second(self): top = tk.Tk() top.title('second') frame = tk.Frame(top) self.w = tk.Entry(top) b1 = tk.Button(top, text='Next', command=self.third) self.w.grid() b1.grid() frame.grid() top.mainloop() a = MyClass() a.second() -- http://mail.python.org/mailman/listinfo/python-list