当前位置: 首页>>代码示例>>Python>>正文


Python GUI.start_event_loop方法代码示例

本文整理汇总了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()
开发者ID:bergtholdt,项目名称:pyface,代码行数:27,代码来源:test_gui.py

示例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()
开发者ID:Biomechanics-NTNU,项目名称:Vascular1DFlow,代码行数:27,代码来源:class3dVisualisation.py

示例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()
开发者ID:hassyma,项目名称:mayavi,代码行数:27,代码来源:show.py

示例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()
开发者ID:archcidburnziso,项目名称:apptools,代码行数:29,代码来源:example.py

示例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
开发者ID:archcidburnziso,项目名称:apptools,代码行数:30,代码来源:example.py

示例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()
开发者ID:PerryZh,项目名称:mayavi,代码行数:10,代码来源:ivtk.py

示例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()
开发者ID:bergtholdt,项目名称:pyface,代码行数:12,代码来源:hello_world.py

示例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
开发者ID:bobye,项目名称:uchicago-pyanno,代码行数:16,代码来源:pulse_progress_dialog.py

示例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()
开发者ID:gdberrio,项目名称:Code-samples,代码行数:16,代码来源:run.py

示例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()
开发者ID:bergtholdt,项目名称:pyface,代码行数:18,代码来源:step1.py

示例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()
开发者ID:B-Rich,项目名称:mayavi,代码行数:21,代码来源:mlab.py

示例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
开发者ID:BabeNovelty,项目名称:blockcanvas,代码行数:21,代码来源:application_main.py

示例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
开发者ID:enthought,项目名称:enable,代码行数:23,代码来源:example_application.py

示例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
开发者ID:OspreyX,项目名称:pyface,代码行数:41,代码来源:run.py

示例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()
开发者ID:OspreyX,项目名称:pyface,代码行数:24,代码来源:run.py


注:本文中的pyface.api.GUI.start_event_loop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。