[Python] Why do I have 2 red dots on my KivyMD2.0.0 screen. I am using a KV string and I am...

Discussão em 'Python' iniciado por Stack, Março 5, 2025.

  1. Stack

    Stack Membro Participativo

    I am a newbie using Stack Overflow and kivymd. Why do I have 2 unexpected red dots on my KivyMD2.0.0 screen? I have created a KV string in my Python code to reproduce the behavior. This code loads a KV string and renders it.

    from kivy.lang import Builder
    from kivymd.app import MDApp

    KV = """
    MDScreen:
    canvas.before:
    Color:
    rgba: 1, 1, 1, 1 # Light background color (white)
    Rectangle:
    size: self.size
    pos: self.pos
    MDBoxLayout:
    orientation: "vertical"
    MDTopAppBar:
    font_style: "Display"
    role: "small"
    size_hint_x: 1 # This makes sure the top bar spans the full width of the screen
    pos_hint: {"top": 1} # Ensures the TopAppBar is at the top of the screen
    MDTopAppBarLeadingButtonContainer:
    MDActionTopAppBarButton:
    icon: "arrow-left"
    on_release: app.back_to_previous_screen()
    MDTopAppBarTitle:
    id: edit_cards_top_app_title
    text: "Manager App"
    MDTopAppBarTrailingButtonContainer:
    MDActionTopAppBarButton:
    icon: "file-document-multiple"
    MDBadge:
    id: edit_cards_badge_table_rows
    text: "0"
    md_bg_color: 0/255, 128/255, 128/255, 1 # teal by default (RGBA)
    MDActionTopAppBarButton:
    icon: "database"
    MDBadge:
    id: edit_cards_badge_table
    text: "0"
    md_bg_color: 0, 0, 1, 1 # blue by default (RGBA)
    MDScrollView:
    pos_hint_x: 1
    size_hint_y: 1
    MDList:
    #size_hint_y: None
    #height: self.minimum_height
    pos_hint_x: 1 #{"center_x": .5}
    id: double_card_list
    MDBoxLayout:
    orientation: 'horizontal'
    size_hint_y: None
    height: "480dp" # Define the size here for both card
    padding: "10dp" # Define the space outside around the MDCard here
    spacing: "10dp" # Define the horizontal space between the cards here
    # Row1 Card1
    MDCard:
    size_hint_x: None
    size_hint_x: "400dp"
    elevation: 10
    radius: [10]
    MDBoxLayout:
    orientation: 'vertical'
    padding: "10dp" # Inside the border of the card
    spacing: "5dp"
    MDLabel:
    text: "Product Information"
    halign: "center"
    # Row1 Card2
    MDCard:
    size_hint_x: None
    size_hint_x: "400dp"
    #size_hint_y: None
    #size_hint_y: "750dp"
    elevation: 10
    radius: [10]
    MDBoxLayout:
    orientation: 'vertical'
    padding: "10dp" #Inside the border of the card
    spacing: "5dp"
    MDLabel:
    text: "Agency Information"
    halign: "center"
    MDListItem:
    id: status_bar
    size_hint_y: None
    height: "40dp"
    #md_bg_color: (137/255, 196/255, 244/255, 1) # Jordy blue background (RGBA) # Do not work
    #size_hint_x: 0.85
    #pos_hint: {"center_x": 0.5} # Center the status bar
    size_hint_x: 1
    MDListItemHeadlineText:
    text: "Status :"
    MDListItemSupportingText:
    id: status_bar_supporting_text
    text: "Supporting text:"
    MDListItemTertiaryText:
    text: "Tertiary text"
    """
    class Example_unexpected_2_red_dot_(MDApp):
    def build(self):
    return Builder.load_string(KV)


    Example_unexpected_2_red_dot_().run()


    Any idea on how to correct this code to avoid to have this 2 red dots? Why these 2 dots are coming out of the blue?

    Screnshot : unexpected_2red_dots_on_the_screen

    I try to convert the initial KV file with 4k lines to a simple KV string. I have isolated this behavior in this simplified code.

    Continue reading...

Compartilhe esta Página