Tkinter menus made easy

Discussion in 'Python' started by MartinRinehart@gmail.com, Mar 27, 2008.

  1. Guest

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

    http://www.martinrinehart.com/articles/menus.py

    Run it. Then look at the source (bottom of file). There's a bit more
    doc in the doc comment at the top.

    Peer review is most welcome.
     
    , Mar 27, 2008
    #1
    1. Advertising

  2. 2008/3/27, <>:
    > 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.

    > http://www.martinrinehart.com/articles/menus.py
    >
    > Run it. Then look at the source (bottom of file). There's a bit more
    > doc in the doc comment at the top.
    >
    > Peer review is most welcome.
    >
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >



    --
    -- Guilherme H. Polo Goncalves
     
    Guilherme Polo, Mar 27, 2008
    #2
    1. Advertising

  3. Guest

    On Mar 27, 3:54 pm, wrote:
    > 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
     
    , Mar 27, 2008
    #3
  4. Guest

    Guilherme Polo wrote:
    > 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?
     
    , Mar 27, 2008
    #4
  5. Guest

    wrote:
    > 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?
     
    , Mar 27, 2008
    #5
  6. Guest

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


    Some of those fields are optional :)

    Bye,
    bearophile
     
    , Mar 28, 2008
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vilmar
    Replies:
    0
    Views:
    506
    Vilmar
    May 27, 2004
  2. news.west.cox.net

    Select menus above flyout menus? help?

    news.west.cox.net, Dec 8, 2004, in forum: HTML
    Replies:
    8
    Views:
    821
  3. Mel
    Replies:
    0
    Views:
    374
  4. Alex

    XML to CSV made easy?

    Alex, Dec 12, 2003, in forum: XML
    Replies:
    1
    Views:
    571
    Ray Tayek
    Dec 13, 2003
  5. Robert Buck
    Replies:
    0
    Views:
    458
    Robert Buck
    Feb 24, 2004
Loading...

Share This Page