[Pythonmac-SIG] Tkinter questions

Steven D. Majewski sdm7g@virginia.edu
Wed, 21 Apr 1999 18:10:44 -0400 (EDT)


As noted in previous message: I've been using native Mac toolbox lately
and haven't been using Tkinter on mac for a while, but I dug out some
old Tkinter code and tried it. 

It looks like this behaviour may be due to the changes in Tk 8.0.x to 
support Mac style menu's. I don't think the earlier versions behaved 
like this. 

It looks like when you create a Tk root: 
	root = Tkinter.Tk() 

that Python's menu bar get's overwritten with Tk's menu default menu bar.
If you look at the apple menu, just before that call, you have 'About 
Python', and right after, you have 'About Tcl & Tk' .

The Tk menus, however, won't do anything until you run the mainloop:
	root.mainloop() 

Then, when you QUIT from the Tk menubar, the Python menubar reappears.
However, the Python interpreter has terminated, so you can't type in
the listener window, but you can QUIT the Python app, or select 'About
Python' from the apple menu. 


Earlier versions of Tk didn't support the Mac style single menu bar --
you got a Tk style menu bars in each window. I didn't notice this 
problem in Wish, as there, as in Python, the default menu bar is the
default unless you explicitly change it. In this case though, what 
we're getting is Python's default menubar (and behaviour) being replaced
with Tk's default menubar. 


I don't yet know if there is a simple way around this problem. 

- Steve M. 


On Wed, 21 Apr 1999, Samuel Smith wrote:

> Mac Tkinter Newbie problems:
> 
> I am asking questions for the Mac mainly because 1) I prefer macs, if given
> a choice. 2) I am testing the waters for the activily level of the Python
> community, and it appears that mac support is weakest in Python so this is
> a worst case test.
> 
> When I run the tutorial Tkinter examples in Mac Python I found the
> following problems:
> 
> The python menubar gets replaced with a new menu bar who's menus apparently
> do nothing.
> 
> I can't quit python once I close a Tkinter window (the Tkinter menu bar
> stays on the screen) The only way I could figure out to quit python was to
> do a sys.exit(). I bound sys.exit to my Tk quit button but that doesn't
> work for the close box on the window title bar.
> 
> 
> It seems that I should be able to close a Tk window without having to do a
> sys.exit() that kills python as well.
> 
> Why does Tkinter put up a new menu bar by default and I do I disable it. (I
> suppose once I get far enough into Tk I can define my own menubar somehow
> and override it but it seems to me that by default Tkinter should do
> something friendly with the menu bar.
> 
> I read the Tkinter.py file and could not find any code that creates this
> new menubar. Where is it made? in _tkinter?
> 
> Tk docs refer to a resource file. How is this supported on the Mac. (Other
> platforms)
> 
> 
> I crashed my system a couple of times using Tk with the Mac IDE (Just Van
> Rossum's) Is this a serious incompatiblity problem or something that can be
> fixed with a little debugging)
> 

---|  Steven D. Majewski   (804-982-0831)  <sdm7g@Virginia.EDU>  |---
---|  Department of Molecular Physiology and Biological Physics  |---
---|  University of Virginia             Health Sciences Center  |---
---|  P.O. Box 10011            Charlottesville, VA  22906-0011  |---

    Caldera Open Linux: "Powerful and easy to use!" -- Microsoft(*)
     (*) <http://www.pathfinder.com/fortune/1999/03/01/mic.html>