In <[EMAIL PROTECTED]>, gmarkowsky wrote: > Hi all, > > I'm trying to import a class from a module. The class looks like this: > class App: > > def __init__(self, master): > > frame = Frame(master) > frame.pack() > > self.button = Button(frame, text=text_1, command= self.comm_1) > self.button.pack(side=LEFT) > > self.hi_there = Button(frame, text=text_2, command=self.comm_2) > self.hi_there.pack(side=LEFT) > > def comm_1(self): > command1() > root.quit() > > def comm_2(self): > command2() > root.quit() > > It's supposed to just make a Tkinter window with two choices. The > problem is that when I import it from a module, I get the following > error: > > NameError: global name 'Frame' is not defined > > But when I copy and paste it into the file, it works. Can anyone tell > me what's wrong?
Yes, the global name `Frame` is not defined. `Frame` is a name in the `Tkinter` module and you have to import it to reference it. Add the following import statement to your file: from Tkinter import Frame, Button You use `Button` too and this also lives in the `Tkinter` module. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list