【发布时间】:2012-07-25 13:18:55
【问题描述】:
Why wxframe isn't raised from a function called with global gtk binder? 之后我又遇到了另一个奇怪的行为..
谁能给我一个解决方案(提示也很好:))这个..?
import wx, os
import keybinder
class FrameWithHotKey(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
hotkey = "<Ctrl>period"
keybinder.bind(hotkey, self.toggle_shown)
def toggle_shown(self):
# windowNow id
if self.IsShown():
self.Hide()
else:
self.Show()
self.Raise()
print self.IsActive()
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = FrameWithHotKey(None)
app.MainLoop()
如果按下热键 isActive 总是返回 false。为什么?
【问题讨论】: