def launch(interactive=False, **kwargs): if interactive: a = InteractiveLauncher(NodeApp(**kwargs)) else: a = NodeApp(**kwargs) a.run() return a
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
from kivy.app import App from kivy.interactive import InteractiveLauncher from kivy.uix.boxlayout import BoxLayout from kivy.uix.button import Button class MyKivyApp(App): def build(self): return BoxLayout() app = InteractiveLauncher(MyKivyApp()) app.run() btn1 = Button(text="I'm Spartacus!") app.root.add_widget(btn1) btn2 = Button(text="NOOOOO! I'm Spartacus!") app.root.add_widget(btn2) app.root.orientation = 'vertical' app.root.orientation = 'horizontal' def my_click_action(instance): btn2.text = "No your not! your a very naughty boy!" btn1.bind(on_press=my_click_action)
from kivy.interactive import InteractiveLauncher from kivy.app import App from kivy.uix.button import Button class MyApp(App): def build(self): return Button(text='Hello Shell') launcher = InteractiveLauncher(MyApp()) launcher.run() # ================================================ from kivy.interactive import SafeMembrane interactiveLauncher.attribute = myNewObject # myNewObject is unsafe myNewObject = SafeMembrane(myNewObject) # myNewObject is now safe. Call at will. myNewObject.method() SafeMembrane.safeIn() #fará com que o aplicativo seja pausado SafeMembrane.safeOut() #permitirá a um aplicativo pausado continuar
from kivy.lang import Builder kvcode = """ BoxLayout: orientation: "vertical" padding: 20 spacing: 50 Button: size_hint: 1., 1. text: "A" Button: size_hint: 1., 1. text: "B" Button: size_hint: 1., 1. text: "C" """ class JanelaApp(App): def build(self): return Builder.load_string(kvcode) janela = JanelaApp() ji = InteractiveLauncher(janela) ji.run()
fig.canvas.mpl_connect('button_press_event', press) fig.canvas.mpl_connect('button_release_event', release) fig.canvas.mpl_connect('key_press_event', keypress) fig.canvas.mpl_connect('key_release_event', keyup) fig.canvas.mpl_connect('motion_notify_event', motionnotify) fig.canvas.mpl_connect('resize_event', resize) fig.canvas.mpl_connect('scroll_event', scroll) fig.canvas.mpl_connect('figure_enter_event', figure_enter) fig.canvas.mpl_connect('figure_leave_event', figure_leave) fig.canvas.mpl_connect('close_event', close) canvas = fig.canvas # Add each navigation toolbar and canvas to our BoxLayout nav1 = NavigationToolbar2Kivy(canvas) self.add_widget(nav1.actionbar) self.add_widget(canvas) class GuiApp(App): pass # Entry point if __name__ == '__main__': INTERACTIVE_MODE = False if INTERACTIVE_MODE: launcher = InteractiveLauncher(GuiApp()) launcher.run() else: GuiApp().run()
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