I've created a custom widget in a .kv file, but I need a way to create an instance of that custom widget in my python script like I would any other widget like a Label. Is there any way to do this, or any way to create something similar to a css class that could be referenced in a python file? This is my kivy code so far:
<News@Label>:
font_size: 25
color: 0, 0, 0, 1
font_family: 'Serif'
And here's the python code where I'm trying to create an instance of the custom widget:
class BiteApp(App):
def build(self):
return MyGrid()
def on_start(self):
app = App.get_running_app()
for story in range(len(newsScrape.getNewsGlobal())):
app.root.ids.newsGrid.add_widget(Label(text=newsScrape.getNewsGlobal()[story], cls="News"))
I tried using "cls='News'" as a last-ditch effort, but that obviously didn't work out