So I wanted to write some code to provide a framework for math quizzes. Among other things, I wanted to be able to show LaTeX-like output on a canvas. But first, I just wanted to get the canvas showing simple text.
Part of the code:
def get_level_string(self):
return self.f1.level_text.get()
def set_level_string(self, text):
print "here"
self.f1.level_text.set(text + str(self.levels[self.level]))
level_string = property(get_level_string, set_level_string)
...
# Left side user feedback frame
self.f1 = Frame(master=self)
self.f1.level_text = StringVar()
(1) --> self.f1.level_text.set("Level: " + str(self.levels[self.level]))
(2) --> print self.level_string
(3) --> self.level_string = "Level: "
print self.level_string
self.f1.level_label = Label(master=self.f1, textvariable=self.f1.level_text)
self.f1.level_label.grid()
...
The output on the screen is as follows:
Level: 1
Level:
In other words, the code (1) operates differently from the code (3) even though (3) does (in principle) exactly the same thing.
Any thoughts?
Thanks,
Jeff