Bottom Page

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.
Quote
#2
self.add.widget should be self.add_widget
Quote
#3
Wao..... @Yoriz,
Thank you very much, you just save my head now.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [Kivy] Kivy Designer Module Error SARAVANAN_M 0 829 Nov-20-2019, 09:57 AM
Last Post: SARAVANAN_M
  Help with code Kivy/Python Couzer 1 1,081 Nov-13-2018, 02:24 AM
Last Post: joe_momma
  Python Kivy Emerogork 1 1,433 Mar-19-2018, 09:30 AM
Last Post: wavic

Forum Jump:


Users browsing this thread: 1 Guest(s)