本文整理汇总了Python中wx.GUIEventLoop方法的典型用法代码示例。如果您正苦于以下问题:Python wx.GUIEventLoop方法的具体用法?Python wx.GUIEventLoop怎么用?Python wx.GUIEventLoop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.GUIEventLoop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_event_loop
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GUIEventLoop [as 别名]
def start_event_loop(self, timeout=0):
# docstring inherited
if hasattr(self, '_event_loop'):
raise RuntimeError("Event loop already running")
timer = wx.Timer(self, id=wx.ID_ANY)
if timeout > 0:
timer.Start(timeout * 1000, oneShot=True)
self.Bind(wx.EVT_TIMER, self.stop_event_loop, id=timer.GetId())
# Event loop handler for start/stop event loop
self._event_loop = wx.GUIEventLoop()
self._event_loop.Run()
timer.Stop()
示例2: start_event_loop
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GUIEventLoop [as 别名]
def start_event_loop(self, timeout=0):
"""
Start an event loop. This is used to start a blocking event
loop so that interactive functions, such as ginput and
waitforbuttonpress, can wait for events. This should not be
confused with the main GUI event loop, which is always running
and has nothing to do with this.
This call blocks until a callback function triggers
stop_event_loop() or *timeout* is reached. If *timeout* is
<=0, never timeout.
Raises RuntimeError if event loop is already running.
"""
if hasattr(self, '_event_loop'):
raise RuntimeError("Event loop already running")
id = wx.NewId()
timer = wx.Timer(self, id=id)
if timeout > 0:
timer.Start(timeout * 1000, oneShot=True)
self.Bind(wx.EVT_TIMER, self.stop_event_loop, id=id)
# Event loop handler for start/stop event loop
self._event_loop = wx.GUIEventLoop()
self._event_loop.Run()
timer.Stop()