I am trying to define a function inside a function in python3
as
from gi.repository import Gtk, GObject
class EntryWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Generate Init")
self.set_size_request(100, 50)
self.nument = Gtk.Entry()
<did some work>
def get_nument(self,nument):
numele= self.nument.get_text()
print(numele)
<did some more work and define a function again>
def get_specs(self,spec):
numspec=self.spec.get_text()
resulting to an error:
Traceback (most recent call last):
File "hw3.py", line 42, in get_nument
self.spec.connect("activate",self.get_specs)
AttributeError: 'EntryWindow' object has no attribute 'get_specs'
I am really new to python, so trying hard for understanding the scope of self and origin of this error. Also, possibly I am doing things really funny by declaring a function inside a function, according to this post.
What I need is to define a function(get_specs
) which will be called by another function (get_nument
).
This is actually a gtk3 code, but I guess its problem with python. The complete code, at its present state can be seen here. Kindly help.