本文整理汇总了Python中pyface.gui.GUI.start_event_loop方法的典型用法代码示例。如果您正苦于以下问题:Python GUI.start_event_loop方法的具体用法?Python GUI.start_event_loop怎么用?Python GUI.start_event_loop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyface.gui.GUI
的用法示例。
在下文中一共展示了GUI.start_event_loop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GUIApplication
# 需要导入模块: from pyface.gui import GUI [as 别名]
# 或者: from pyface.gui.GUI import start_event_loop [as 别名]
#.........这里部分代码省略.........
return ok
# -------------------------------------------------------------------------
# 'GUIApplication' Private interface
# -------------------------------------------------------------------------
def _create_windows(self):
""" Create the initial windows to display.
By default calls :py:meth:`create_window` once. Subclasses can
override this method.
"""
window = self.create_window()
self.add_window(window)
# -------------------------------------------------------------------------
# 'Application' private interface
# -------------------------------------------------------------------------
def _run(self):
""" Actual implementation of running the application: starting the GUI
event loop.
"""
# Fire a notification that the app is running. This is guaranteed to
# happen after all initialization has occurred and the event loop has
# started. A listener for this event is a good place to do things
# where you want the event loop running.
self.gui.invoke_later(
self._fire_application_event, 'application_initialized'
)
# start the GUI - script blocks here
self.gui.start_event_loop()
return True
# Destruction methods -----------------------------------------------------
def _can_exit(self):
""" Check with each window to see if it can be closed
The fires closing events for each window, and returns False if any
listener vetos.
"""
if not super(GUIApplication, self)._can_exit():
return False
for window in reversed(self.windows):
window.closing = event = Vetoable()
if event.veto:
return False
else:
return True
def _prepare_exit(self):
""" Close each window """
# ensure copy of list, as we modify original list while closing
for window in list(reversed(self.windows)):
window.destroy()
window.closed = window
def _exit(self):
""" Shut down the event loop """
self.gui.stop_event_loop()
# Trait default handlers ------------------------------------------------