Ir para conteúdo
Fórum Script Brasil

Kleverson Cuzzuol Lopes

Membros
  • Total de itens

    2
  • Registro em

  • Última visita

Posts postados por Kleverson Cuzzuol Lopes

  1. Olá, desejo que estejam bem.

    Sou novato em desenvolvimento com python e kivymd.
    quando executo meu App estou recebendo um erro quando tento adicionar um widget em um MDGridLayout

    Minha intenção é criar todo layout de tela no .kv  e apenas indicar o que quero preencher no .py (espero que dê para entender o que quero fazer)

    msg de Erro:

    GradeComandas.add_widget(GLComandasAbertas(comanda))
     TypeError: add_widget() missing 1 required positional argument: 'widget'

    .kv

    <GradeComandas>:
        MDGridLayout:
            cols: 3
            row_force_default: True
            row_default_height: 100
            padding: 4

    <scrComandas>:
        MDBoxLayout:
            MDToolbar:
                title: 'Comandas em Aberto'
                pos_hint: {'top': 1}
                elevation: 10
                icon: 'git'
                type: 'top'
                left_action_items: [['menu', lambda x: root.callback()]]
                right_action_items: [['plus', lambda x: root.callback()],["dots-vertical", lambda x: app.callback_1()]]
                #on_action_button: app.callback(self.icon)
                mode: 'center'
        MDBoxLayout:
            GradeComandas:

    .py

    class scrComandas(MDScreen):
        def __init__(self, **kwargs):
            super(scrComandas, self).__init__(**kwargs)
            dados = [
                    ['0001','Antony Stark   ','R$ 25,50'],
                    ['0002','Steve Roger    ','R$ 15,50'],
                    ['0003','Natasha Romanov','R$ 15,50'],
                    ['0004','Bruce Banner   ','R$ 12,50'],
                    ['0005','Scot Lang      ','R$  0,50']
            ]
            for comanda in dados:
                GradeComandas.add_widget(GLComandasAbertas(comanda))

            self.add_widget(GradeComandas)


    class GradeComandas(MDGridLayout):
        def __init__(self, **kwargs):
            super(GradeComandas, self).__init__(**kwargs)


    class GLComandasAbertas(MDGridLayout):
        def __init__(self, comanda):
            super().__init__()

            self.rows = 1
            self.row_force_default = True
            self.row_default_height = 75
            self.add_widget(MDRectangleFlatButton(text=comanda[0]+'\n'+comanda[1]+'\n'+comanda[2], on_press=self.onClique))

      def onClique(self, instance):
            pass

×
×
  • Criar Novo...