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.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()
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
from kivy.app import App from kivy.uix.widget import Widget from kivy.interactive import InteractiveLauncher from kivy.config import Config Config.set('graphics', 'fullscreen', '0') Config.set('modules', 'console', '') class EstudoApp(App): def build(self): return Widget() j = EstudoApp() i = InteractiveLauncher(j) i.run() #from kivy.uix.button import Button #bt = Button(text="estudo") #i.root.add_widget(bt) #bt.text = "oi"
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()