我想使用 python 模块 kivymd 中的 OneLineListItem 添加文本。当我运行代码时,我只得到滚动视图,屏幕内没有文本。我不确定我做错了什么。我想从任何人那里得到任何想法。我在下面发布了代码,请随意查看代码。大家好,我需要解决我的问题。谢谢!!from kivymd.app import MDAppfrom kivy.core.window import Windowfrom kivymd.uix.list import ThreeLineAvatarListItem, ImageLeftWidgetWindow.size = (360, 500)class DemoApp(MDApp): def build(self): self.theme_cls.primary_palette = "Yellow" self.theme_cls.primary_hue = 'A400' self.theme_cls.theme_style = 'Dark' pass def on_start(self): for i in range(10): image = ImageLeftWidget(source="soldier.jpg") items = ThreeLineAvatarListItem(text="Item " + str(i), secondary_text="Hello World", tertiary_text="Third text") items.add_widget(image) self.root.ids.container.add_widget(items)#:include firebaseloginscreen.kv#:import FirebaseLoginScreen firebaseloginscreen.FirebaseLoginScreen#:import utils kivy.utils#: import FadeTransition kivy.uix.screenmanager.FadeTransition#: import SlideTransition kivy.uix.screenmanager.SlideTransition#FloatLayout:ScreenManager: id: screen_manager canvas.before: Color: rgb: 1,1,1 Rectangle: size: self.size pos: self.pos FirebaseLoginScreen: canvas.before: Rectangle: size: self.size pos: self.pos source: "heart.png" id: firebase_login_screen name: "firebase_login_screen" size_hint: 1,1 pos_hint: {"top": 1, "right": 1} web_api_key: "AIaSyCqafRzds38uZDLlKuI" primary_color: utils.get_color_from_hex("#e6e600")#("#EE682A") secondary_color: utils.get_color_from_hex("#060809") tertiary_color: utils.get_color_from_hex("#434343")
1 回答
慕后森
TA贡献1802条经验 获得超5个赞
经过不放弃,我终于找到了问题所在。默认情况下,文本颜色为白色,与屏幕颜色相同。我必须更改文本的颜色,为此我使用了参数 ---> OneLineListItem(theme_text_color="Custom", text_color=(241 / 255, 196 / 255, 15 / 255, 0.8))
添加回答
举报
0/150
提交
取消