Try adding:
from Tkinter import *
at the beginning, and you don't need "var" in front of root=Tk(), just
"root = Tk()" (<-without the quotes of course)
What OS are you on? Are you running "python testapp.py" or similar to
make it run?
-Chuckk
On Sun, May 4, 2008 at 12:39 PM, Protected <[EMAIL PROTECTED]> wrote:
> Good thinking. It was indented with spaces, so I replaced them with tabs.
> Now I'm getting a SyntaxError: invalid syntax in root = Tk(). If I split the
> code in two parts (with the second one beginning in that line) and run them
> separately, I get no errors, but still nothing happens.
>
> class Application(Frame):
> def say_hi(self):
> print "hi there, everyone!"
>
> def createWidgets(self):
> self.QUIT = Button(self)
> self.QUIT["text"] = "QUIT"
> self.QUIT["fg"] = "red"
> self.QUIT["command"] = self.quit
>
> self.QUIT.pack({"side": "left"})
>
> self.hi_there = Button(self)
> self.hi_there["text"] = "Hello",
> self.hi_there["command"] = self.say_hi
>
> self.hi_there.pack({"side": "left"})
>
> def __init__(self, master=None):
> Frame.__init__(self, master)
> self.pack()
> self.createWidgets()
>
> var root = Tk()
> app = Application(master=root)
> app.mainloop()
> root.destroy()
>
> On Sun, May 4, 2008 at 12:33 PM, Q4 <[EMAIL PROTECTED]> wrote:
>
> > On Sun, 4 May 2008 02:23:37 -0700 (PDT), Protected <[EMAIL PROTECTED]>
> > wrote:
> >
> >
> >
> > > Hello. I'm a complete newbie trying to learn Python. I decided to try
> > > some Tkinter examples, including the one from the library reference,
> > > but they don't seem to do anything! Shouldn't there be, like, a
> > > dialog?
> > >
> > > I'm running Windows XP and using IDLE. You can assume my version of
> > > Python is the latest.
> > > --
> > > http://mail.python.org/mailman/listinfo/python-list
> >
> > If you just copy the code from the python doc the indentation might be
> > broken.
> > Send the code and I'll take a look at it.
> >
> > Do you get any errors?
> >
> > --
> > My website:
> > http://www.riddergarn.dk/koder/
> >
> >
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://www.badmuthahubbard.com
--
http://mail.python.org/mailman/listinfo/python-list