wxpython 获取当前选定的笔记本选项卡标签(不是索引)
我有一个 EVT_NOTEBOOK_PAGE_CHANGED 函数来在选项卡更改时提醒我,但我只能让它告诉我笔记本选项卡的索引:
self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.eventntbkParameters, self.ntbkParameters)
&
page = self.ntbk.GetSelection()
print page
我不认为以这种方式确定选择哪个选项卡是非常安全的,以防将来添加额外的选项卡,从而重新排列索引。 是否可以获取选项卡的标签?
谢谢
I have an EVT_NOTEBOOK_PAGE_CHANGED function to alert me when the tab changes, but I can only get it to tell me the index of the notebook tab:
self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.eventntbkParameters, self.ntbkParameters)
&
page = self.ntbk.GetSelection()
print page
I don't think this it is very safe to determine the which tab is selected in this way in case an extra tab is added in the future, reshuffling the indices.
Is it possible to get the label of the tab instead?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要
ntbk.GetPageText(evt.GetSelection())
。You want
ntbk.GetPageText(evt.GetSelection())
.