本文整理匯總了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 ------------------------------------------------