Tkinter menus made easy

G

Guilherme Polo

2008/3/27 said:
Writing Tkinter menu code used to be rather tedious, uninspiring work.
I figured that I could delegate the job to a program:

I didn't look at it yet, but just in case you weren't aware there is a
gui designer tool for tkinter called GUI Designer (what a bad name),
which used to be called SpecTcl, where you can design the menus and it
then converts to python code.
 
B

bearophileHUGS

Writing Tkinter menu code used to be rather tedious, uninspiring work.
I figured that I could delegate the job to a program:

I did develop a proggy that takes the following as input, it's part of
my "agui" project, you can use it as an idea to improve your code:

menudef = """
File
New, callNew, Ctrl-N
New Window, callNewWindow, Ctrl-Shift-N
__
Open, lambda e=0:para(1), Ctrl-O
__
Save, lambda e=0:para(2), Ctrl-S
Save As, CallSaveAs, F12
__
Minimize, called, Ctrl-M
Magic, called, Alt-X
Edit
Cut, called, Ctrl-X
Copy, called, Ctrl-C
Paste, called, Ctrl-V
__
Align
Left,
Right,
___
"""
m = Menu(root, globals(), menudef)

Callee:
def __init__(self, root, globalVars, menuDef, font=None, fieldSep=",",
itemSep="_"):
....

Bye,
bearophile
 
M

MartinRinehart

Guilherme said:
there is a
gui designer tool for tkinter called GUI Designer (what a bad name),
which used to be called SpecTcl, where you can design the menus and it
then converts to python code.

I tried it. after about 10 minutes I was as far as "help not found."

Is anyone out there using this tool? Worth the learning curve?
 
M

MartinRinehart

menudef = """
File
New, callNew, Ctrl-N
New Window, callNewWindow, Ctrl-Shift-N
__
Open, lambda e=0:para(1), Ctrl-O

Nice design. I looked at it for a few seconds and didn't even
think about pressing F1.

Mine does less. But you tell it less to do it.

Is there no way to get underscore/ keyboard access for
the main menu items?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top