Object-oriented GUI development in python
- by ptabatt
Hey guys, new programmer here. I have an assignment for class and I'm stuck... What I need to do is a create a GUI that gives someone a basic arithmetic problem in one box, asks the person to answer it, evaluates it, and tells you if you're right or wrong...
Basically, what I have is this:
[code]
class Lesson(Frame):
def init (self, parent=None):
Frame.init(self, parent)
self.pack()
Lesson.make_widgets(self)
def make_widgets(self):
Label(self, text="").pack(side=TOP)
ent = Entry(self)
self.a = randrange(1,10)
self.b = randrange(1,10)
self.expr = choice(["+","-"])
ent.insert(END, str(self.a) + str(self.expr) + str(self.a))
[/code]
I've broken this down into many little steps and basically, what I'm trying to do right now is insert a default random expression into the first entry widget. When I run this code, I just get a blank Label. Why is that? How can I put a something like "7+7" into the box? If you absolutely need background to the problem, it's question #3 on this link.
http://reed.cs.depaul.edu/lperkovic/csc242/homeworks/Homework8.html
-Thanks for all help in advance.