Python/Kivy : Call function from one class to another class and show widget in Python

后端 未结 2 1562
一生所求
一生所求 2021-02-06 19:24

I am using Python-2.7 and Kivy. When I run test.py then a show button shows. When I click on the show button then a label and value shows. I am fetching it from

2条回答
  •  天命终不由人
    2021-02-06 20:08

    You are creating a new Invoice instance instead of using the existing one.

     Invoice().abc()
    

    try instead:

    class EditPopup(Popup):
        mode = StringProperty("")
        label_rec_id = StringProperty("Id")
        col_data = ListProperty(["?", "?", "?"])
        index = NumericProperty(0)
    
        def __init__(self, obj, **kwargs):
            super(EditPopup, self).__init__(**kwargs)
            self.obj = obj # will need it later...
    
        def update(self,obj):
            #cur.execute("UPDATE `item` SET itemName=?, itemCode=? WHERE itemId=?",
                    #('Item1', 9999, 11))
            #con.commit()
    
            self.obj.abc()  # was Invoice().abc()
    

提交回复
热议问题