You access it on self
, just like when you set it on the instance in __init__
:
if self.user_entry.get_text() == books:
where you get the text out of the Gtk.Entry()
object by calling the get_text()
method on it.
Note that your check_answer
method needs to take a self
argument for this to work, and must accept the original object as an argument:
def check_answer(self, button):
if self.user_entry.get_text() == books:
current += 1
total += 1
currentscore = current
If you need some extra arguments to be passed in, you need to pass these in to submit.connect()
:
submit.connect("clicked", self.check_answer, total, current)
but I suspect that total
and current
and currentscore
are also attributes on your class.
Perhaps another reading of the Python tutorial on classes would be helpful?