We have a slider_encoder(self) function inside a RobotController class with a self parameter, How dow w call this function outsi | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

We have a slider_encoder(self) function inside a RobotController class with a self parameter, How dow w call this function outsi

We have a slider_encoder(self) function inside a RobotController class with a self parameter, How do we call this function outside the class?

13th May 2019, 12:15 PM
Zhenis Otarbay
Zhenis Otarbay - avatar
3 Answers
+ 4
It would help to see the code. If it is just a normal method, it works like this: The definition goes def method_x(self, arg): ... and the method call goes instance.method_x(arg) So you just leave out the self when you call it (that's where instance internally goes).
21st May 2019, 11:01 AM
HonFu
HonFu - avatar
21st May 2019, 10:52 AM
Gordon
Gordon - avatar
+ 2
🤔 i tag you because i see tkinter After reading your answer, looks like i can answer myself too 😂
21st May 2019, 11:04 AM
Gordon
Gordon - avatar