开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜