什么';它的意思是'&;字符串';在wxpython/python中

什么';它的意思是'&;字符串';在wxpython/python中,python,wxpython,Python,Wxpython,我是个巨蟒迷 我读 并发现字符串前面有&,例如: Then we add some items into the menu. This can be done in two ways. file.Append(101, '&Open', 'Open a new document') file.Append(102, '&Save', 'Save the document') 及 和的含义是什么 谢谢你的帮助 表示菜单中的加速器字母 当菜单打开并在键盘上点击该字母时,您可以跳

我是个巨蟒迷 我读

并发现字符串前面有&,例如:

Then we add some items into the menu. This can be done in two ways.


file.Append(101, '&Open', 'Open a new document')
file.Append(102, '&Save', 'Save the document')

的含义是什么


谢谢你的帮助

表示菜单中的加速器字母

当菜单打开并在键盘上点击该字母时,您可以跳转到该菜单选项,或者作为快捷键与修改键(ALT-F可打开文件菜单项等)一起直接跳转

从:

普通菜单项(非分隔符)的标签字符串可能包括可用于从键盘激活菜单项的加速器。可以使用符号和
&
字符指定加速键。为了在菜单项文本中嵌入符号和字符,符号和必须加倍

使用和号标记油门键不限于wxPython;这是Microsoft Windows引入的一种约定,您会发现它在许多不同的GUI框架中使用。根据:

此约定起源于第一个WIN32 api,在Windows窗体中使用,也被复制到多个操作系统上的许多其他Tookit中


或者当您使用Alt/Meta时。
Menus are then added into the menubar.


menubar.Append(file, '&File')
menubar.Append(edit, '&Edit')