Modifiers for HyperlinkEvent?
I've got a wxPython application where I'm using an AuiNotebook, and HyperlinkCtrl widgets, to present the user with an interface sort of like tabbed web browsing.
Currently I open links in new tabs, or the current one, depending on the kind of link, etc. I'd like to let the users control whether or not they get a new window by having them control-click links. I can't find any way of doing that, though.
Thus: In my HyperlinkEvent handler, how can I determine if the user was using any keyboard modifiers while clicking?
use wx.GetKeyState(int id)
:
(docs)
Get the state of a key (true if pressed or toggled on, false if not.) This is generally most useful getting the state of the modifier or toggle keys. On some platforms those may be the only keys that this function is able to detect.
if wx.GetKeyState(wx.WXK_CONTROL):
# open in new tab
else:
# open in new windows
精彩评论