[PythonCE] Using Tkinter

Guido Wesdorp mailings at johnnydebris.net
Mon Nov 3 08:31:35 EST 2003


Voidspace wrote:

> It's the *most* basic example of Tk use from the 'programming python' 
> book !
>
> from Tkinter import *
> root = Tk()
> Label(root, text='Hello GUI world!').pack(side=TOP)
> root.mainloop()
>
> For example....... !!

Well I'm really sure that will work on my installation: I already wrote 
a couple of small Tkinter scripts and they worked just fine... So I 
doubt whether I can reproduce this one (but I'll try anyway tonight).

> Whereas entering the same lines one at a time in the interpreter works !
> Except in the example below... root.quit *doesn't* cause the window to 
> dissapear...... ?
>
> from Tkinter import *
> root = Tk()
> Button(root, text='press', command=root.quit).pack(side=LEFT)
> root.mainloop()

That's right, but that's due to a 'try: except' that catches systemexits 
and such as well, even if you call 'sys.exit()' from a Python script it 
will leave the interpreter open... I can try to find that as well, don't 
know when I'm going to have time to browse through the pcceshell.py to 
search for that though...

Cheers,

Guido

P.S. Just noticed that I saw only your messages in the thread, obviously 
I'm not used to mailinglists that don't add their own address to the 
reply-to list ;) I'll try to keep it in mind, although I think your 
quoting made things clear enough for readers to follow the thread ;)




More information about the PythonCE mailing list