Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WxPython Ampersand Use

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/

like image 560
tabchas Avatar asked Mar 30 '26 18:03

tabchas


1 Answers

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

like image 70
Anthony Kong Avatar answered Apr 02 '26 08:04

Anthony Kong



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!