Ejemplo n.º 1
0
def app(request):
    """Uses the InteractiveLauncher to provide access to an app instance.

    The finalizer stops the launcher once the tests are finished.

    Returns:
      :class:`WitnessAngelClientApp`: App instance
    """
    from kivy.interactive import InteractiveLauncher
    from waclient.waclient_app import WitnessAngelClientApp

    launcher = InteractiveLauncher(WitnessAngelClientApp("en"))

    def stop_launcher():
        launcher.safeOut()
        launcher.stop()

    request.addfinalizer(stop_launcher)

    launcher.run()
    launcher.safeIn()
    return launcher.app
Ejemplo n.º 2
0
class MyPaintWidget(Widget):
    def on_touch_down(self, touch):
        with self.canvas:
            Color(1, 1, 0)
            d = 30.
            Ellipse(pos=(touch.x - d / 2, touch.y - d / 2), size=(d, d))


class TestApp(App):
    def build(self):
        return Widget()


i = InteractiveLauncher(TestApp())
i.run()
i.app()
i.root.confirmed()
#i.    # press 'tab' to list attributes of the app
#i.root.  # press 'tab' to list attributes of the root widget

# App is boring. Attach a new widget!
i.root.add_widget(MyPaintWidget())

i.safeIn()
# The application is now blocked.
# Click on the screen several times.
i.safeOut()
# The clicks will show up now

# Erase artwork and start over
#i.root.canvas.clear()