本文整理汇总了Python中pyface.api.GUI.start_event_loop方法的典型用法代码示例。如果您正苦于以下问题:Python GUI.start_event_loop方法的具体用法?Python GUI.start_event_loop怎么用?Python GUI.start_event_loop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyface.api.GUI
的用法示例。
在下文中一共展示了GUI.start_event_loop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SimpleApplication
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
class SimpleApplication(HasStrictTraits):
"""
Simple application that attempts to set a trait at start time,
and immediately exits in response to that trait.
"""
# The GUI instance underlying this app.
gui = Instance(IGUI)
# Event fired after the event loop starts.
application_running = Event
def __init__(self):
super(HasStrictTraits, self).__init__()
self.gui = GUI()
def start(self):
"""
Start the application.
"""
# This shouldn't be executed until after the event loop is running.
self.gui.set_trait_later(self, 'application_running', True)
self.gui.start_event_loop()
def stop(self):
self.gui.stop_event_loop()
示例2: visualize
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
def visualize(self):
'''
Start the visualisation of the simulation result.
Set up Upgrade method and starts the main loop.
Use only if the simulation result was set!
'''
# update the lookuptables and set them
minL = []
maxL = []
for array in self.scalarSolution[self.solutionPosition][self.scalarPosition].itervalues():
minL.append(array.min())
maxL.append(array.max())
self.SourceMin = min(minL)
self.SourceMax = max(maxL)
for actor in self.vizActors.itervalues():
actor.module_manager.scalar_lut_manager.data_range = [self.SourceMin, self.SourceMax]
#self.vizActors[0].module_manager.scalar_lut_manager.data_name = self.scalarNames[self.solutionPosition][self.scalarPosition]
#self.vizActors[0].module_manager.scalar_lut_manager.show_scalar_bar = True
timer = Timer(0.03, self.update)
gui = GUI()
gui.busy = True
gui.start_event_loop()
示例3: wrapper
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
def wrapper(*args, **kw):
"""Wrapper function to run given function inside the GUI event
loop.
"""
global _gui, _stop_show
tk = ETSConfig.toolkit
if is_ui_running():
# In this case we should not pop up the UI since we likely
# don't want to stop the mainloop.
return func(*args, **kw)
else:
g = GUI()
if tk == "wx":
# Create a dummy app so invoke later works on wx.
a = ApplicationWindow(size=(1, 1))
GUI.invoke_later(lambda: a.close())
a.open()
GUI.invoke_later(func, *args, **kw)
_gui = g
if stop:
# Pop up the UI to stop the mainloop.
_stop_show = StopShow()
g.start_event_loop()
示例4: main
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
def main(argv):
"""A simple example of using the workbench."""
# Create the GUI.
gui = GUI()
# Create the workbench.
#
# fixme: I wouldn't really want to specify the state location here.
# Ideally this would be part of the GUI's as DOMs idea, and the state
# location would be an attribute picked up from the DOM hierarchy. This
# would also be the mechanism for doing 'confirm' etc... Let the request
# bubble up the DOM until somebody handles it.
workbench = ExampleWorkbench(state_location=gui.state_location)
# Create the workbench window.
window = workbench.create_window(position=(300, 300), size=(800, 600))
window.open()
# This will cause a TraitsUI editor to be created.
window.edit(Person(name='fred', age=42, salary=50000))
# This will cause a toolkit specific editor to be created.
window.edit("This text is implemented by a toolkit specific widget.")
# Start the GUI event loop.
gui.start_event_loop()
示例5: main
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
def main(argv):
""" A simple example of using the the application scripting framework in a
workbench.
"""
# Create the GUI.
gui = GUI()
# Create the workbench.
workbench = ExampleScript(state_location=gui.state_location)
window = workbench.create_window(position=(300, 300), size=(400, 300))
window.open()
# Create some objects to edit.
# FIXME v3: The need to explicitly set the style to its default value is
# due to a bug in the implementation of Scriptable.
label = Label(text="Label", style='normal')
label2 = Label(text="Label2", style='normal')
# Edit the objects.
window.edit(label)
window.edit(label2)
# Start the GUI event loop.
gui.start_event_loop()
return
示例6: main
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
def main():
# Create the GUI.
gui = GUI()
# Create and open an application window.
window = IVTKWithCrustAndBrowser(size=(800,600))
window.open()
# Start the GUI event loop!
gui.start_event_loop()
示例7: main
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
def main():
# Create the GUI.
gui = GUI()
# Create and open the main window.
window = MainWindow()
window.open()
# Start the GUI event loop!
gui.start_event_loop()
示例8: main
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
def main():
""" Entry point for standalone testing/debugging. """
from pyface.api import GUI
gui = GUI()
progress_dialog = PulseProgressDialog(title="Test", message="Doing something possibly interesting...")
progress_dialog.open()
gui.invoke_after(3000, progress_dialog.close)
gui.start_event_loop()
return
示例9: main
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
def main(argv):
# Create the GUI (this does NOT start the GUI event loop).
gui = GUI()
# Create a Task and add it to a TaskWindow.
task = ExampleTask()
window = TaskWindow(size=(800, 600))
window.add_task(task)
# Show the window.
window.open()
# Start the GUI event loop.
gui.start_event_loop()
示例10: main
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
def main(argv):
""" A simple example of using Tasks.
"""
# Create the GUI (this does NOT start the GUI event loop).
gui = GUI()
# Create a Task and add it to a TaskWindow.
task = BlankTask()
window = TaskWindow(size=(800, 600))
window.add_task(task)
# Show the window.
window.open()
# Start the GUI event loop.
gui.start_event_loop()
示例11: main
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
def main():
gui = GUI()
# Create and open an application window.
window = ivtk.IVTKWithCrustAndBrowser(size=(800,600))
window.open()
f = Figure(window.scene)
# Create an outline.
o = Outline()
f.add(o)
# Create some pretty pictures.
#test_lines(f)
test_surf(f)
window.scene.reset_zoom()
# Start the GUI event loop!
gui.start_event_loop()
示例12: main
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
def main(argv):
""" A simple example of using the the undo framework in a workbench. """
# Create the GUI.
gui = GUI()
# Create the workbench.
workbench = ApplicationWorkbench(state_location=gui.state_location)
window = workbench.create_window(position=(300, 300), size=(400, 300))
window.open()
# fixme: This is a little silly...
window.edit(workbench.app.project.active_experiment)
# Start the GUI event loop.
gui.start_event_loop()
return
示例13: demo_main
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
def demo_main(cls, **traits):
""" Create the demo application and start the mainloop, if needed
This should be called with appropriate arguments which will be passed to
the class' constructor.
"""
# get the Pyface GUI
gui = GUI()
# create the application's main window
window = cls(**traits)
window.open()
# start the application
# if there isn't already a running mainloop, this will block
gui.start_event_loop()
# if there is already a running mainloop (eg. in an IPython session),
# return a reference to the window so that our caller can hold on to it
return window
示例14: main
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
def main(argv):
""" A simple example of using the workbench. """
# Create the GUI (this does NOT start the GUI event loop).
gui = GUI()
# Create some objects to edit.
fred = Person(name='fred', age=42)
wilma = Person(name='wilma', age=35)
# Create the workbench.
#
# fixme: I wouldn't really want to specify the state location here.
# Ideally this would be part of the GUI's as DOMs idea, and the state
# location would be an attribute picked up from the DOM hierarchy. This
# would also be the mechanism for doing 'confirm' etc... Let the request
# bubble up the DOM until somebody handles it.
workbench = ExampleWorkbench(state_location=gui.state_location)
# Create some workbench windows.
x = 300; y = 300
for i in range(2):
window = workbench.create_window(position=(x, y), size=(800, 600))
window.open()
# Edit the objects if they weren't restored from a previous session.
if window.get_editor_by_id('fred') is None:
window.edit(fred)
if window.get_editor_by_id('wilma') is None:
window.edit(wilma)
# Cascade the windows.
x += 100; y += 100
# Start the GUI event loop.
gui.start_event_loop()
return
示例15: main
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import start_event_loop [as 别名]
def main(argv):
""" A simple example of using Tasks.
"""
# Create the GUI (this does NOT start the GUI event loop).
from traits.etsconfig.api import ETSConfig
ETSConfig.toolkit = 'qt4'
from enaml.qt.qt_application import QtApplication
app = QtApplication()
gui = GUI()
# Create a Task and add it to a TaskWindow.
task = EnamlTask()
window = TaskWindow(size=(800, 600))
window.add_task(task)
# Show the window.
window.open()
# Start the GUI event loop.
gui.start_event_loop()