I'm slowly (VERY slowly) getting my arms wrapped around Tkinter and ttk (the
themed widgets), but I'm up against a brick wall with menus.
The problem is my "Application" menu (what I believe Tkinter still calls the
"Apple" menu, that being an OS9 hold-over according to Google). I've been all
over Google, but can't seem to find the answer - probably because I'm not quite
asking the right question.
My problem is that I can't get control over my application/apple menu. When
I'm running in the python interpreter, that menu says Python. The code below
generates an application menu, but puts it to the right of where I want it to
be, which would be either incorporated in the Python menu or replacing it.
If I convert the script to a stand-alone application using py2app, I get two
menus with the application name, mine is still one to the right of where I want
it; the system defaults still appear, but now they appear under my application
name.
I've extracted the minimal code to demonstrate my problem below (bits of what
would otherwise be the main application are still ghosts).
I'd sure appreciate it if someone could point out what I'm missing.
System details: OS-X 10.8.2, Python 2.7 from python.org, not Apple's python.
Thanks in advance,
Bill
-----------
#!/usr/bin/env python
from Tkinter import *
import ttk
root = Tk()
root.title("CM GUI test 2")
Main_frame = ttk.Frame(root, width=200, height=100, padding=(3,3,12,12))
def Nada():
filewin = (Main_frame)
nada = ttk.Button(filewin, text="Do Nada")
nada.grid(column=0, row= 0, columnspan=3)
menubar = Menu(root)
applemenu = Menu(menubar, tearoff = FALSE)
applemenu.add_command(label = "About CM_GUI_2", command = Nada)
applemenu.add_command(label = "Check for updates...", command = Nada)
menubar.add_cascade(label = "CM_GUI_2", menu=applemenu)
filemenu = Menu(menubar, tearoff=FALSE)
filemenu.add_command(label='New', command = Nada)
filemenu.add_command(label='Open', command = Nada)
filemenu.add_command(label='Save', command = Nada)
filemenu.add_command(label='Save As...', command = Nada)
filemenu.add_separator()
filemenu.add_command(label="Quit", command=root.quit)
menubar.add_cascade(label="File", menu=filemenu)
Main_frame.grid(column=0, row=0, columnspan=3, rowspan=2, sticky=(N, S, E, W))
root.config(menu = menubar)
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
Main_frame.columnconfigure(0, weight=1)
root.mainloop()
_______________________________________________
Pythonmac-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG