2015-05-09 38 views
2

如何将工具提示添加到wx.Menu()的元素中?下面是我的项目编写的代码:wxPython - 将工具提示添加到菜单项目

#Patient menu (1st menu): 
self.patientMenu = wx.Menu() 
self.registerNewPatient = self.patientMenu.Append(-1, 'Cadastrar paciente...') 
self.listPatientsByName = self.patientMenu.Append(-1, u'Listar pacientes em ordem alfabética') 
self.listPatientsByNumber = self.patientMenu.Append(-1, u'Listar pacientes por número em ordem crescente') 
self.searchForPatients = self.patientMenu.Append(-1, 'Pesquisar paciente(s)...') 
#Appointment menu (2nd menu): 
self.appointmentMenu = wx.Menu() 
self.seeAppointmentsForToday = self.appointmentMenu.Append(-1, 'Visualizar consultas de hoje') 
self.registerNewAppointment = self.appointmentMenu.Append(-1, 'Marcar consulta...') 
self.cancelAppointment = self.appointmentMenu.Append(-1, 'Desmarcar consulta...') 
self.seeAppointmentsForOtherSpecificDate = self.appointmentMenu.Append(-1, 'Pesquisar consultas...') 
#Exit menu (3rd menu): 
self.exitMenu = wx.Menu() 
self.exitProgram = self.exitMenu.Append(-1, 'Encerrar') 
#Menu bar: 
self.menuBar = wx.MenuBar() 
self.menuBar.Append(self.patientMenu, 'Paciente') 
self.menuBar.Append(self.appointmentMenu, 'Consulta') 
self.menuBar.Append(self.exitMenu, 'Sair') 
self.SetMenuBar(self.menuBar) 

回答

1

从我能收集它看起来像共识是,你要绑定一个事件来听wx.EVT_MENU_HIGHLIGHTwx.EVT_LIST_ITEM_SELECTED然后抓住选定的id菜单也许GetMenuId和使用某种地图/字典显示帮助信息,或者它看起来像它可能可以Set the help string虽然它看起来像这可能是另一种可能的解决方案:

另见balloontip

我不知道这是否仍是如此,因为一些这些答案都是有点过时。

相关:

+0

谢谢你的链接。其实,我并没有这样想。为了提供带有简单工具提示的菜单元素,我希望这是一种简单的方法。 –

+0

有:http://wxpython.org/Phoenix/docs/html/ToolTip.html?highlight=tooltip ...但这似乎是整个窗口。如果他们得到时间,您可能会收到Mike或Robin的回复。他们通常在wxpython标签上非常活跃。我还添加了另一个链接到balloontip。 – jmunsch

相关问题