import text kivi
у меня есть код, который выводит на MDLabel текст, но очень не удобно писать код и текст в одном файле,как мне импортировать текст в код киви?Пробовал с помощью .txt но пишет : ... ValueError: None is not allowed for MDLabel._text
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.image import Image
from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.properties import ObjectProperty
KV = '''
Screen:
NavigationLayout:
ScreenManager:
id: screen_manager
Screen:
name: "screen 1"
BoxLayout:
orientation: 'vertical'
MDBottomNavigation:
MDBottomNavigationItem:
name: 'screen 1.3.1'
text: 'Python'
icon: 'language-python'
Carousel:
id: carousel
Screen:
MDLabel:
id : text_sreen1
text: app.text_up_1()
pos_hint: {"center_y": .8, "center_x": .49}
Screen:
MDLabel:
id : text_sreen2
text: app.text_up_2()
pos_hint: {"center_y": .8, "center_x": .49}
Screen:
MDLabel:
id : text_sreen3
text: app.text_up_3()
pos_hint: {"center_y": .8, "center_x": .49}
Screen:
MDLabel:
id : text_sreen4
text: app.text_up_4()
pos_hint: {"center_y": .8, "center_x": .49}
'''
class TestNavigationDrawer(MDApp):
def build(self):
self.root = Builder.load_string(KV)
def text_up_1(self):
text_1 = \
'''
присвоить значение тексту!!
'''
return text_1
def text_up_2(self):
text_2 = \
'''
присвоить значение тексту2!!
'''
return text_2
def text_up_3(self):
text_3 = \
'''
присвоить значение текст3!!
'''
return text_3
def text_up_4(self):
text_4 = \
'''
присвоить значение текст4!!
'''
return text_4
TestNavigationDrawer().run()