Nov-08-2021, 11:30 PM
(This post was last modified: Nov-09-2021, 12:13 AM by Yoriz.
Edit Reason: Added prefix
)
From what i found online, below error should be satisfied if the called method has self included as an argument. To me it appears i have that part satisfied but i still get the error. calling the on_button method from btnAccept.bind(on_press=self.on_button)
Error:Exception has occurred: TypeError (note: full exception trace is shown but execution is paused at: <module>)
on_button() takes 1 positional argument but 2 were given
File "/home/mark/Python Environments/FirstEnvProject/ClassTest6.py", line 107, in <module> (Current frame)
CreateApp().run()
class MyApp(TabbedPanel): def __init__(self,data_base): super(MyApp, self).__init__() ... if str(i)=='Add': myTPHM.content=self.enterScreen() def enterScreen(self): stkEnter=StackLayout(orientation='lr-tb',spacing=4) lbl1=Label(text='Tag No',size_hint=(.1,.04)) lbl2=Label(text='Location',size_hint=(.1,.04)) ... stkEnter.add_widget(btnAccept) btnAccept.bind(on_press=self.on_button) return stkEnter def on_button(self): self.db.insert_cattledata(self.txtTag.text,self.txtLoc.text,self.txtSex.text,self.txtType.text) self.txtTag.text='' self.txtLoc.text='' self.txtSex.text='' self.txtType.text='' ...