python - Running multiple Kivy apps at same time that communicate with each other -


i kivy application able spawn multiple apps (i.e. new windows) on windows machine can communicate each other.

screenmanager , popup options not cut because live in same window..i need able drag new screens across multiple monitors , therefore need multiple windows.

kivy docs explicitly state "kivy supports 1 window per application: please don't try create more one."

a google search produces this simple approach of simple spawning new app within app, so:

from kivy.app import app kivy.uix.button import button kivy.uix.label import label   class childapp(app):     def build(self):         return label(text='child')   class mainapp(app):      def build(self):         b = button(text='launch child app')         b.bind(on_press=self.launchchild)         return b      def launchchild(self, button):         childapp().run()  if __name__ == '__main__':     mainapp().run() 

however, when this, launches app within same window , crashes, , terminal spits out crazy:

original exception was: error in sys.exceptionhook: 

i same result if instead of childapp().run() multiprocessing.process(target=childapp().run()).start()

using subprocess library gets me closer want:

# filename: test2.py  kivy.app import app kivy.uix.label import label   class childapp(app):     def build(self):         return label(text='child')  if __name__ == '__main__':     childapp().run() 

# filename: test.py  kivy.app import app kivy.uix.button import button  import subprocess   class mainapp(app):      def build(self):         b = button(text='launch child app')         b.bind(on_press=self.launchchild)         return b      def launchchild(self, button):         subprocess.call('ipython test2.py', shell=true)  if __name__ == '__main__':     mainapp().run() 

this spawns child window without error, main window locked (white canvas) , if close child window, gets reopened.

they need able pass data between 1 another. ideas on how correctly in windows? post seems suggest possible i'm not sure start.

i'm not sure why doesn't work multiprocessing (i've never tried it), should @ least work subprocess. reason main window locked because subprocess.call blocks thread calls while waits subprocess finish , return result.

you want use subprocess.popen instead, not block.


Comments