How do I make this python code containing kivy run in another python code containing kivy like you would call a function so I can have different segment of the code. I don't want too much code on a particular python file because I would be dealing with large code.
import kivy
from kivy.app import App
from kivy.uix.floatlayout import Floatlayout
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.label import Label
class LandingScreen(FloatLayout):
def __init__(self, **kwargs):
super(LandingScreen, self).__init__(**kwargs)
self.btn1=Button(text='button1 ', size_hint=(0.5, 0.5),
on_press=self.click_b1))
self.btn2=Button(text='button2', size_hint=(0.5, 0.5),
on_press=self.click_b2))
self.add_widget(self.btn1)
self.add_widget(self.btn2)
def click_b1(self, instance):
pass
def click_b2(self, instance):
pass
class SplashApp(App):
def build(self):
return LandingScreen()
if __name__ == '__main__':
SplashApp().run()
How do I call this python file inside this other python file below supposed the first file is a.py and the second file is b.py
import kivy
from kivy.app import App
from kivy.uix.floatlayout import Floatlayout
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.label import Label
class LandingScreen2(FloatLayout):
def __init__(self, **kwargs):
super(LandingScreen2, self).__init__(**kwargs)
self.btn3=Button(text='button1 ', size_hint=(0.5, 0.5),
on_press=self.click_b3))
self.btn4=Button(text='button2', size_hint=(0.5, 0.5),
on_press=self.click_b4))
self.add_widget(self.btn3)
self.add_widget(self.btn4)
def click_b3(self, instance):
pass
def click_b4(self, instance):
pass
class SplashApp(App):
def build(self):
return LandingScreen2()
if __name__ == '__main__':
SplashApp().run()