我一直在为盲人开发一个应用程序,所以我决定在GUI中使用python和wxPython。问题是我无法使用选项卡导航wx.toolbar。这是我的实际代码
menuToolBar = self.CreateToolBar(style=wx.TB_FLAT)
menuToolBar.AddSeparator()
menuToolBar.AddTool(ID_NUEVO, "Nuevo Archivo", wx.Bitmap(
os.path.join(self.__rutaPrincipal, "img/nueva pagina.png")), "Nuevo Archivo")
menuToolBar.AddSeparator()
menuToolBar.AddTool(ID_GUARDAR_ARCHIVO, "Guardar Archivo", wx.Bitmap(
os.path.join(self.__rutaPrincipal, "img/guardar pagina.png")), "Guardar Archivo")
menuToolBar.AddTool(ID_ABRIR_ARCHIVO, "Abrir Página", wx.Bitmap(
os.path.join(self.__rutaPrincipal, "img/abrir pagina.png")), "Abrir Página")
menuToolBar.AddSeparator()
menuToolBar.AddTool(ID_FOCUS_PANEL_ESCRITURA, "Foco Escritura", wx.Bitmap(
os.path.join(self.__rutaPrincipal, "img/panel escritura.png")), "Foco Escritura")
menuToolBar.AddTool(ID_FOCUS_PANEL_RESULTADO, "Foco Resultado", wx.Bitmap(
os.path.join(self.__rutaPrincipal, "img/panel resultado.png")), "Foco Resultado")
menuToolBar.AddSeparator()
menuToolBar.AddTool(ID_CERRAR_PAGINA, "Cerrar Página", wx.Bitmap(
os.path.join(self.__rutaPrincipal, "img/cerrar pagina.png")), "Cerrar Página")
menuToolBar.AddSeparator()
menuToolBar.Realize()
是否有任何配置来实现它?或者可能还有其他组件可以帮助我?。 P.D.我不熟悉python开发和Stackoverflow
您需要在
MenuBar
中实现Accelerators
,可能还需要在MenuItem
中实现通常,通过传递
wx.AcceleratorTable
,使用菜单项中的文本设置这些属性此处
&Play
将P
设置为菜单加速器,并将Ctrl+p设置为菜单项所代表函数的热键。换句话说,在浏览菜单时,按
P
将选择播放菜单项。不浏览菜单时,只需按Ctrl+P键即可运行该功能。注意
&
符号和字符放在同一个字母之前,因为只有第一个字母起作用。e、 g.“&;Save”和“Sa&;ve as”将起作用,使用
S
表示“Save”,使用V
表示“Save as”一些带有菜单加速器但没有指定热键的最小代码:
运行此代码并按
Alt
键,按其中一个未加下划线的字母F、E或H,然后使用箭头键或任何带下划线的字母导航菜单注意:某些功能会自动分配热键,例如Ctrl+Q退出
我没有删除现有的anwser,它实际上回答了一个不同的问题,而是保留它,因为我个人认为它在相关方面是有用的
下面是我在评论中提到的一个例子,关于制作您自己的工具栏,您可以使用Tab键、左箭头键和右箭头键进行导航。
这应该足以让你开始
它使用一个普通按钮和一些通用位图按钮,两者都可以工作,因为我们需要说明哪个按钮当前具有焦点,这是通过为每个按钮使用至少2个不同的位图来实现的。一个正常,一个聚焦
相关问题 更多 >
编程相关推荐