Answer the question
In order to leave comments, you need to log in
Add KV Kivy elements?
Hello.
There is a code:
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
kv_string = """
<Start>
Button:
text: "Hello"
"""
Builder.load_string(kv_string)
class Start(Screen):
kv_string = kv_string + """\n Button:\n text: 'Bye'"""
sm = ScreenManager()
sm.add_widget(Start(name="Start"))
class MainApp(App):
def build(self):
return sm
root.manager.current = "Start"
if __name__ == "__main__":
app = MainApp()
app.run()
Answer the question
In order to leave comments, you need to log in
It's decided.
After kv_string = kv_string + ..... added Builder.load_string
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question