Skip to content Skip to sidebar Skip to footer

How To Get Value Of Textinput With Kivy

I'm new to Kivy and as i'm not able to practice on PySide (some dynamic libraries broken or i don't know what) i want to try this huge tool. I'm lost right now, i tried to do like

Solution 1:

ajouter method is a member of ProduitScreen not Button so you should use root to refer to it:

Button:
        text: 'Ajouter'
        on_press: root.ajouter()

Also fix issues on your definition of ajouter:

classProduitScreen(Screen):
    defajouter(self):
        print"%s au prix de %f a ete ajoute" % (self.nom.text , float(self.prix.text))

In order to use nom and prix inside your python code, add this to kv code:

<ProduitScreen>:nom:nomprix:prix

Post a Comment for "How To Get Value Of Textinput With Kivy"