How to (open/make) new window in Kivy-Python
You can use subprocess
for this
main.py
from kivy.app import App
from kivy.lang import Builder
import subprocess
import sys
from threading import Thread
KV = """
BoxLayout:
orientation: 'vertical'
Button:
text: "Open new window"
on_release: app.open_window()
"""
class MainApp(App):
def build(self):
return Builder.load_string(KV)
@staticmethod
def open_window():
Thread(target=lambda *largs: subprocess.run([sys.executable, "new_window.py"])).start()
if __name__ == "__main__":
MainApp().run()
new_window.py
from kivy.app import App
from kivy.lang import Builder
KV = """
Screen:
Label:
text: 'An additional window opened'
"""
class TestApp(App):
def build(self):
return Builder.load_string(KV)
TestApp().run()