[Pythonmac-SIG] Problems with Tkinter
Mon, 10 Apr 2000 01:48:34 -0700
I just ran into this. I'm no Tkinter or Python expert, but here's what I
If you're typing this in interactively, add the following after the
This doesn't seem to work if you run a script non-interactively - it seems
that it gets destroyed automatically. Garbage collection, I guess.
To avoid namespace pollution, my personal style (for the examples I've done)
is to do this:
tk = Tkinter
root = tk.Tk()
button = tk.Button( etc. )
PS As a doctor, you should know the value of sleep. I hope you're getting a
solid 8 hours. :-)
PPS That has got to be one of the most hippocritical remarks I've ever made.
PPPS I'm sorry.
PPPPS I'll shut up and go to bed now. Hopefully I can sleep.
on 4/10/00 12:29 AM, DrBHorow@aol.com at DrBHorow@aol.com wrote:
> I'm a physician and love to program in my spare time. I've had alot of
> experience programming in Tcl/Tk and just started learning Python,
> particularly to explore Tkinter.
> I'm trying a simple script like this:
> from Tkinter import *
> root = Tk()
> button = Button(root, text = "Test")
> Everything works ok on the Tk end of things. The toplevel window appears with
> a button and accepts clicks. The problem I'm having is that as soon as Python
> interprets mainloop(), Tk takes over the menubar and all event handling. I
> can't reliably interrupt mainloop. Even when I do interrupt it (sometimes by
> typing), the original menubar in the Python interpreter is not restored.
> Windows do not refresh properly. I usually have to quit Python to the Finder
> (by hitting command-option-shift-esc).
> I'm running a G3 powerbook/OS 8.1 or 8.6, Tcl/Tk v8.0, Python v1.5.2.
> Any help would be much appreciated.
> Bob Horowitz
> Pythonmac-SIG maillist - Pythonmac-SIG@python.org