Mac Tk console (was Re: [Pythonmac-SIG] Question about Tkinter
listbox)
Russell E Owen
owen@astro.washington.edu
Thu, 31 May 2001 08:37:08 -0700
>Debugging Python/Tk programs on Mac is not as cool as on Unix and
>Windows, because when you are running Tk you cannot use Python Console,
>and the best thing to debug Tk programs is to have a console.
I found the lack of a Mac console a real hassle, so I made a simple
window for executing scripts. It is called ROStdTk and you can get it
at <http://www.astro.washington.edu/owen/>. It's like the IDE's
script windows rather than a console. You enter scripts by typing or
opening files, then run them by hitting the Run button.
If you make your windows globally available then your ROStdTk scripts
can see them. For example, the following common paradigm (which runs
test code if your module is directly executed instead of being
imported) allows you to see everything:
if __name__ == "__main__":
import ROStdTk
root = ROStdTk.ROStdTk() # opens a script window and returns Tk()
newWindow = Toplevel(root)
# etc. -- the script window can see Tk and newWindow
root.mainloop()