TypeError: object.__init__() takes exactly one argument (the instance to initialize) to design robot gui

I need to develop GUI application for robot and i’m facing this issue.

Code snippet:
import kivy
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.graphics import Color, Rectangle


class RobotTeachPendant(App):
def init(self, **kwargs):
self.joint_values = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
self.records =
self.labels = {} # Store references to joint labels

def increase_value(self, joint_index):
    self.joint_values[joint_index] += 1

def decrease_value(self, joint_index):
    self.joint_values[joint_index] -= 1

def reset_values(self):
    self.joint_values = [0, 0, 0, 0, 0, 0, 0]
    for i in range(7):

def add_record(self):
    x = self.joint_values[0]
    y = self.joint_values[1]
    z = self.joint_values[2]
    self.records.append((x, y, z))
    print(f"Added record: ({x}, {y}, {z})")

def update_label(self, joint_index):
    label = self.labels[joint_index]
    label.text = str(self.joint_values[joint_index])

def build(self):
    root = GridLayout(cols=1, spacing=10, padding=[10, 20])
    with root.canvas.before:
        Color(0.95, 0.95, 0.95, 1)  # Set background color
        self.rect = Rectangle(pos=root.pos, size=root.size)

    for i in range(7):
        joint_layout = GridLayout(cols=3, spacing=10, size_hint=(1, None), height=100)

        joint_label = Label(id=f"joint_{i+1}_label", text=f"Joint {i+1}:", size_hint=(0.4, 1))

        minus_button = Button(text="-", size_hint=(0.2, 1))
        minus_button.bind(on_release=lambda btn, index=i: self.decrease_value(index))

        joint_value_label = Label(text="0", size_hint=(0.2, 1))

        self.labels[i] = joint_value_label

        plus_button = Button(text="+", size_hint=(0.2, 1))
        plus_button.bind(on_release=lambda btn, index=i: self.increase_value(index))


    reset_button = Button(text="Reset", size_hint=(1, None), height=40)
    reset_button.bind(on_release=lambda btn: self.reset_values())

    record_button = Button(text="Record", size_hint=(1, None), height=40)
    record_button.bind(on_release=lambda btn: self.add_record())

    return root

if name == ‘main’:

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

I tried to create a GUI interface with 7 joints buttons to control the movement, a reset button, play button to resume the motion of the bot, record button to fetch the end effectors x,y and z position.

Error message:

Traceback (most recent call last):
File “kivy_event.pyx”, line 235, in kivy._event.EventDispatcher.init
TypeError: object.init() takes exactly one argument (the instance to initialize)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “c:\Users\BrindaS\kivy_venv\newapp.py”, line 83, in
File “C:\Users\BrindaS\AppData\Roaming\Python\Python311\site-packages\kivy\app.py”, line 955, in run
File “C:\Users\BrindaS\AppData\Roaming\Python\Python311\site-packages\kivy\app.py”, line 925, in run_prepare
root = self.build()
File “c:\Users\BrindaS\kivy_venv\newapp.py”, line 51, in build
joint_label = Label(id=f"joint
{i+1}_label", text=f"Joint {i+1}:", size_hint=(0.4, 1))
disabled’, ‘disabled_color’, ‘disabled_outline_color’, ‘ellipsis_options’, ‘font_blended’, ‘font_context’, ‘font_direction’, ‘font_family’, ‘font_features’, ‘font_hinting’, ‘font_kerning’, ‘font_name’, ‘font_script_name’, ‘font_size’, ‘halign’, ‘height’, ‘ids’, ‘is_shortened’, ‘italic’, ‘line_height’, ‘markup’, ‘max_lines’, ‘mipmap’, ‘motion_filter’, ‘opacity’, ‘outline_color’, ‘outline_width’, ‘padding’, ‘padding_x’, ‘padding_y’, ‘parent’, ‘pos’, ‘pos_hint’, ‘refs’, ‘right’, ‘shorten’, ‘shorten_from’, ‘size’, ‘size_hint’, ‘size_hint_max’, ‘size_hint_max_x’, ‘size_hint_max_y’, ‘size_hint_min’, ‘size_hint_min_x’, ‘size_hint_min_y’, ‘size_hint_x’, ‘size_hint_y’, ‘split_str’, ‘strikethrough’, ‘strip’, ‘text’, ‘text_language’, ‘text_size’, ‘texture’, ‘texture_size’, ‘top’, ‘underline’, ‘unicode_errors’, ‘valign’, ‘width’, ‘x’, ‘y’]

Debug info

  • Streamlit version: (get it with $ streamlit version)
  • Python version: (get it with $ python --version)
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version:
  • Browser version:

Requirements file

Kivy MD using python


I’m not familiar with that kivy library, but it looks like it creates frontend elements. You won’t be able to mix-and-match Streamlit with other frontend libraries without a lot of extra consideration. I don’t see any Streamlit calls in your code, either. Are you trying to build a Streamlit app? Or are you maybe looking for a forum to help you with kivy? I see there are a few thousand members on the Kivy subreddit.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.