Я новичок в python, и в настоящее время я разрабатываю POS-систему, это код тележки клиента. Любая помощь будет принята с благодарностью.
Код:
def update_purchases(self, code):
pcode = self.ids.code_inp.text
products_container = self.ids.products
target_code = "SELECT * FROM stocks WHERE product_code LIKE '%s'"
code = [code]
self.mycursor.execute(target_code, code)
self.mydb.commit()
if target_code == None:
pass
else:
details = BoxLayout(size_hint_y=None, height=30,
pos_hint={'top': 1})
products_container.add_widget(details)
code = Label(text=pcode, size_hint_x=.2, color=(.06, .45, .45, 1))
name = Label(text=target_code['product_name'], size_hint_x=.3,
color=(.06, .45, .45, 1))
qty = Label(text='1', size_hint_x=.1, color=(.06, .45, .45, 1))
disc = Label(text='0.00', size_hint_x=.1, color=(.06, .45, .45, 1))
price = Label(text=target_code['product_price'], size_hint_x=.1,
color=(.06, .45, .45, 1))
total = Label(text='0.00', size_hint_x=.2,
color=(.06, .45, .45, 1))
details.add_widget(code)
details.add_widget(name)
details.add_widget(qty)
details.add_widget(disc)
details.add_widget(price)
details.add_widget(total)
Ошибка:
File "c:\Users\acer\Downloads\pos\operator\operate.kv", line 113, in <module>
on_text_validate: root.update_purchases()
TypeError: update_purchases() missing 1 required positional argument: 'code'