Python Forum
[Kivy] 'Design' had no attribute 'add' Error in Python and Kivy
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Kivy] 'Design' had no attribute 'add' Error in Python and Kivy
#1
Dear All,
Good day, please am new to python development. When I try running this program the error message am getting is
//'ConnectPage' had no attribute 'add'

My code can be found below

import kivy
import os
os.environ ['KIVY_GL_BACKEND'] = 'angle_sdl2'

from kivy import Config
Config.set('graphics', 'multisamples', '0')

from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
kivy.require("1.10.1")

class Design(GridLayout):
def init(self, kwargs):
super().init(kwargs)
self.cols = 2
self.add.widget(Label(text="Username"))
self.Username = TextInput(multiline=False)
self.add_widget(self.Username)

    self.add.widget(Label(text="Password"))
    self.Password = TextInput(multiline=False)
    self.add_widget(self.Password)

class ADU360(App):
def build(self):
return Design()

if name == "main":
ADU360().run()
This is the CMD Error
Traceback (most recent call last):
File "Login.py", line 30, in <module>
ADU360().run()
File "C:\Users\XXX\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\app.py", line 800, in run
root = self.build()
File "Login.py", line 27, in build
return Design()
File "Login.py", line 16, in __init__
self.add.widget(Label(text="Username"))
AttributeError: 'Design' object has no attribute 'add'

I really appreciate you guys help. Thank you in advance.
Reply
#2
self.add.widget should be self.add_widget
Reply
#3
Wao..... @Yoriz,
Thank you very much, you just save my head now.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Kivy error Leo_Red 5 2,538 Apr-11-2021, 04:27 PM
Last Post: Leo_Red
  [Kivy] Kivy Designer Module Error SARAVANAN_M 0 3,840 Nov-20-2019, 09:57 AM
Last Post: SARAVANAN_M
  Help with code Kivy/Python Couzer 1 2,902 Nov-13-2018, 02:24 AM
Last Post: joe_momma
  Python Kivy Emerogork 1 3,010 Mar-19-2018, 09:30 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020