Please help - Tkinter not doing anything

Protected myshelter at gmail.com
Sun May 4 06:22:35 EDT 2008


I had previously ran the import line. I prepended it to the example
code I'm trying to run every time but it did not help, still nothing
happens. With or without var before 'root'. I'm pasting the code in
IDLE and using Windows XP as written in the first post.

On May 4, 11:04 am, "Chuckk Hubbard" <badmuthahubb... at gmail.com>
wrote:
> 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 <protec... at myshelter.net> 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 <q... at invalid.com> wrote:
>
> > > On Sun, 4 May 2008 02:23:37 -0700 (PDT), Protected <myshel... at gmail.com>
> > > 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




More information about the Python-list mailing list