3

What is the point of using the ampersand in wxPython? I see it in almost all the tutorials. For instance, they use:

    menubar.Append(fileMenu, '&File')

instead of:

    menubar.Append(fileMenu, 'File')

What is the difference? Should I always use the ampersand for naming?

Btw I found these examples from this famous wxPython Tutorial: http://zetcode.com/wxpython/menustoolbars/

1 Answer 1

5

The ampersand is to define a shortcut key. In your first example (i.e. "&File"), you can use 'Ctrl-F' to access the 'File' menu item

Sign up to request clarification or add additional context in comments.

2 Comments

Oh awesome... thats pretty straightforward. Does it work by the first letter that is directly in front of the ampersand?
@tabchas I think it is the letter that follows the ampersand

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.