По какой-то причине, когда я запускаю код, мои названия аккордеона являются черными, а текст заголовка не виден, если сравнивать его с примером кода, где аккордеон представляет собой темно-серый с белым текстом. Остальная часть аккордеона прекрасно работает, когда я нажимаю на нее, она расширяется и закрывается. Единственная проблема - названия аккордеона не работают должным образом.
*. Py
#imported from kivy framework
from kivy.app import App
from kivymd.app import MDApp
from kivy.app import App
from kivy.uix.label import Label
from datetime import datetime
from datetime import timedelta
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.image import Image
import dictionaryData
from kivy.lang import Builder
from kivy.base import runTouchApp
import os
from kivy.uix.button import Button
from kivy.uix.accordion import Accordion, AccordionItem
class Main_Screen(Screen):
pass
class Dictionary_Screen(Screen):
def __init__(self, **kwargs):
super().__init__(**kwargs)
layout = BoxLayout(orientation='vertical') # instantiate BoxLayout
self.add_widget(layout) # add BoxLayout to screen
btn2 = Button(
text='change screen',
size_hint=(.5, .05),
)
btn2.bind(on_press=self.changer)
layout.add_widget(btn2) # add Button to BoxLayout
title = ["Title 1", "Title 2", "Title 3", "Title 4", "Title 5"]
accordion = Accordion(orientation='vertical') # instantiate Accordion
layout.add_widget(accordion) # add Accordion to BoxLayout
for x in range(2):
item = AccordionItem(title="Cheese",background_normal= "LogoFF.png")
item.add_widget(Label(text='Very big content\n' * 2))
accordion.add_widget(item) # add AccordionItem to Accordion
def changer(self,*args):
print("ww")
#class for all screens
class ScreenManagement(ScreenManager):
pass
class MainApp(MDApp):
def build(self):
# declaring time from python, and making it refresh every second
self.now = datetime.now()
Clock.schedule_interval(self.update_clock, 1)
def update_clock(self, *args):
self.now = self.now + timedelta(seconds=1)
self.root.get_screen("Main_Screen").ids["CurrentTime"].text = self.now.strftime("%H:%M:%S")
MainApp().run()
*. Kv
#:kivy 1.0
#:import hex kivy.utils.get_color_from_hex
#styles that will apply to all intences for each tag
<MDRaisedButton>:
font_size:18
<Label>:
color: 0,0,0,1
#declaring screen managers and printing them in this order
ScreenManagement:
Main_Screen:
name: "Main_Screen"
Dictionary_Screen:
name: "Dictionary_Screen"
<Main_Screen>:
FloatLayout:
spacing: 10
canvas.before:
Color:
rgba: hex('#eff3fa')
Rectangle:
size: self.size
pos: self.pos
#Navbar
MDToolbar:
id: fb
pos_hint: {'center_x': 0.5, 'top':1.0}
size_hint_y:None
height: 50
title: "Virtual Assistant"
md_bg_color: hex('#132843')
Label:
id: CurrentTime
font_size:18
size_hint_x: .1
color: (1,1,1,1)
BoxLayout:
orientation: 'vertical'
spacing: 10
padding: 50
canvas.before:
Color:
rgba: hex('#000')
Rectangle:
size: self.size
pos: self.pos
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
size_hint: 0.5, 0.5
Button:
text: "Dictionary"
on_release:
app.root.current = "Dictionary_Screen"
<Dictionary_Screen>:
Label:
id: box
color: (1,0,1,1)
Есть ли способ, как я могу это исправить?