kivymd / KivyMD

KivyMD is a collection of Material Design compliant widgets for use with Kivy, a framework for cross-platform, touch-enabled graphical applications. https://youtube.com/c/KivyMD https://twitter.com/KivyMD https://habr.com/ru/users/kivymd https://stackoverflow.com/tags/kivymd
https://kivymd.readthedocs.io
MIT License
2.21k stars 665 forks source link

MDSegmentButtonIcon class can't be initialized #1741

Open JosselinDb opened 6 days ago

JosselinDb commented 6 days ago

KivyMD version: 2.0.1.dev0

I've found that MDSegmentedButtonIcon works well with the KV Builder, but fails when trying to initialize it inside the class.

To reproduce:

from kivymd.app import MDApp

from kivymd.uix.screen import MDScreen
from kivymd.uix.segmentedbutton import (
    MDSegmentedButton,
    MDSegmentButtonLabel,
    MDSegmentButtonIcon,
    MDSegmentedButtonItem,
)

class Example(MDApp):
    def build(self):
        screen = MDScreen()

        segmented_button = MDSegmentedButton(
            MDSegmentedButtonItem(
                MDSegmentButtonIcon(icon="language-python"),
                MDSegmentButtonLabel(text="Python"),
            ),
            MDSegmentedButtonItem(
                MDSegmentButtonIcon(icon="language-javascript"),
                MDSegmentButtonLabel(text="Javascript"),
            ),
        )
        screen.add_widget(segmented_button)

        return screen

Example().run()

error seems to occur in the builder, can't exactly say where it fails