How does this error happen? AttributeError: 'ListAdapter' object has no attribute 'adapter'












0















I recently started learning kivy and when trying to update the ListView I get the error AttributeError: 'ListAdapter' object has no attribute 'adapter'. I was wondering what the logic behind this error is and what I can do to fix it.



Here is the kv text



Builder.load_string("""
#:import ListItemButton kivy.uix.listview.ListItemButton
<HomeScreen>:
BoxLayout:
orientation: 'vertical'
padding: 30
spacing: 30
BoxLayout:
Label:
font_size: 48
text: 'Welcome To Your Gym App'
BoxLayout:
Button:
text: 'Diary'
on_release: root.manager.current = 'diary_screen'

<DiaryScreen>:
date_input_field: date_input_field
group_input_field: group_input_field
BoxLayout:
spacing: 30
padding: 30
orientation: 'vertical'
ListView:
adapter: root.DiaryAdapter
BoxLayout:
size_hint_y: .07
Label:
text: 'Date:'
TextInput:
id: date_input_field
multiline: False
BoxLayout:
size_hint_y: .07
Label:
text: 'Group:'
TextInput:
id: group_input_field
multiline: False
BoxLayout:
size_hint_y: .2
orientation: 'horizontal'
Button:
size_hint_y: None
height: '65dp'
text: 'Back'
on_release: root.manager.current = 'home_screen'
Button:
size_hint_y: None
height: '65dp'
text: 'Edit Entry'
Button:
size_hint_y: None
height: '65dp'
text: 'Add Entry'
on_release: root.add_new_entry()
Button:
size_hint_y: None
height: '65dp'
text: 'Delete Entry'


Here are the classes for building the app and the methods for retrieving/updating the list adapter along with all of my imports. Also the diary_reader import is another class that generates lists and dictionaries from .csv files



import kivy
kivy.require('1.10.1')
from kivy.app import App
from kivy.lang import Builder
from kivy.adapters.listadapter import ListAdapter
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.listview import ListItemButton
from diary_reader import *
from kivy.properties import ObjectProperty

diary_dict = give_completed_dict()
displayed_diary = return_as_list_keys(diary_dict)

class HomeScreen(Screen):
pass


class DiaryScreen(Screen):
date_input_field = ObjectProperty()
group_input_field = ObjectProperty()

def __init__(self, **kwargs):
self.DiaryAdapter = ListAdapter(data=displayed_diary,
cls=ListItemButton)
super(DiaryScreen, self).__init__(**kwargs)

def get_date(self):
the_date = self.date_input_field.text
return the_date

def get_group(self):
the_group = self.group_input_field.text
return the_group

def get_key(self):
d = self.get_date()
g = self.get_group()
new_key = d + ' ' + g
return new_key

def add_new_entry(self):
k = self.get_key()
self.DiaryAdapter.adapter.data.extend([k])
self.DiaryAdapter._trigger_reset_populate()

screen_manager = ScreenManager()
screen_manager.add_widget(HomeScreen(name='home_screen'))
screen_manager.add_widget(DiaryScreen(name='diary_screen'))

class My_GymApp(App):
def build(self):
return screen_manager


if __name__ == '__main__':
My_GymApp().run()


I read the documentation for adapters and listadapters on kivy's website but I still couldn't really figure out what was causing this error.



in add_new_entry
self.DiaryAdapter.adapter.data.extend([k])
AttributeError: 'ListAdapter' object has no attribute 'adapter'










share|improve this question


















  • 1





    ListAdapter does not have an adapter attribute, perhaps you meant self.DiaryAdapter.data.extend([k])?

    – John Anderson
    Nov 21 '18 at 21:42













  • Yep that was this issue and now it works perfectly, thanks!

    – vlovero
    Nov 21 '18 at 22:53
















0















I recently started learning kivy and when trying to update the ListView I get the error AttributeError: 'ListAdapter' object has no attribute 'adapter'. I was wondering what the logic behind this error is and what I can do to fix it.



Here is the kv text



Builder.load_string("""
#:import ListItemButton kivy.uix.listview.ListItemButton
<HomeScreen>:
BoxLayout:
orientation: 'vertical'
padding: 30
spacing: 30
BoxLayout:
Label:
font_size: 48
text: 'Welcome To Your Gym App'
BoxLayout:
Button:
text: 'Diary'
on_release: root.manager.current = 'diary_screen'

<DiaryScreen>:
date_input_field: date_input_field
group_input_field: group_input_field
BoxLayout:
spacing: 30
padding: 30
orientation: 'vertical'
ListView:
adapter: root.DiaryAdapter
BoxLayout:
size_hint_y: .07
Label:
text: 'Date:'
TextInput:
id: date_input_field
multiline: False
BoxLayout:
size_hint_y: .07
Label:
text: 'Group:'
TextInput:
id: group_input_field
multiline: False
BoxLayout:
size_hint_y: .2
orientation: 'horizontal'
Button:
size_hint_y: None
height: '65dp'
text: 'Back'
on_release: root.manager.current = 'home_screen'
Button:
size_hint_y: None
height: '65dp'
text: 'Edit Entry'
Button:
size_hint_y: None
height: '65dp'
text: 'Add Entry'
on_release: root.add_new_entry()
Button:
size_hint_y: None
height: '65dp'
text: 'Delete Entry'


Here are the classes for building the app and the methods for retrieving/updating the list adapter along with all of my imports. Also the diary_reader import is another class that generates lists and dictionaries from .csv files



import kivy
kivy.require('1.10.1')
from kivy.app import App
from kivy.lang import Builder
from kivy.adapters.listadapter import ListAdapter
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.listview import ListItemButton
from diary_reader import *
from kivy.properties import ObjectProperty

diary_dict = give_completed_dict()
displayed_diary = return_as_list_keys(diary_dict)

class HomeScreen(Screen):
pass


class DiaryScreen(Screen):
date_input_field = ObjectProperty()
group_input_field = ObjectProperty()

def __init__(self, **kwargs):
self.DiaryAdapter = ListAdapter(data=displayed_diary,
cls=ListItemButton)
super(DiaryScreen, self).__init__(**kwargs)

def get_date(self):
the_date = self.date_input_field.text
return the_date

def get_group(self):
the_group = self.group_input_field.text
return the_group

def get_key(self):
d = self.get_date()
g = self.get_group()
new_key = d + ' ' + g
return new_key

def add_new_entry(self):
k = self.get_key()
self.DiaryAdapter.adapter.data.extend([k])
self.DiaryAdapter._trigger_reset_populate()

screen_manager = ScreenManager()
screen_manager.add_widget(HomeScreen(name='home_screen'))
screen_manager.add_widget(DiaryScreen(name='diary_screen'))

class My_GymApp(App):
def build(self):
return screen_manager


if __name__ == '__main__':
My_GymApp().run()


I read the documentation for adapters and listadapters on kivy's website but I still couldn't really figure out what was causing this error.



in add_new_entry
self.DiaryAdapter.adapter.data.extend([k])
AttributeError: 'ListAdapter' object has no attribute 'adapter'










share|improve this question


















  • 1





    ListAdapter does not have an adapter attribute, perhaps you meant self.DiaryAdapter.data.extend([k])?

    – John Anderson
    Nov 21 '18 at 21:42













  • Yep that was this issue and now it works perfectly, thanks!

    – vlovero
    Nov 21 '18 at 22:53














0












0








0








I recently started learning kivy and when trying to update the ListView I get the error AttributeError: 'ListAdapter' object has no attribute 'adapter'. I was wondering what the logic behind this error is and what I can do to fix it.



Here is the kv text



Builder.load_string("""
#:import ListItemButton kivy.uix.listview.ListItemButton
<HomeScreen>:
BoxLayout:
orientation: 'vertical'
padding: 30
spacing: 30
BoxLayout:
Label:
font_size: 48
text: 'Welcome To Your Gym App'
BoxLayout:
Button:
text: 'Diary'
on_release: root.manager.current = 'diary_screen'

<DiaryScreen>:
date_input_field: date_input_field
group_input_field: group_input_field
BoxLayout:
spacing: 30
padding: 30
orientation: 'vertical'
ListView:
adapter: root.DiaryAdapter
BoxLayout:
size_hint_y: .07
Label:
text: 'Date:'
TextInput:
id: date_input_field
multiline: False
BoxLayout:
size_hint_y: .07
Label:
text: 'Group:'
TextInput:
id: group_input_field
multiline: False
BoxLayout:
size_hint_y: .2
orientation: 'horizontal'
Button:
size_hint_y: None
height: '65dp'
text: 'Back'
on_release: root.manager.current = 'home_screen'
Button:
size_hint_y: None
height: '65dp'
text: 'Edit Entry'
Button:
size_hint_y: None
height: '65dp'
text: 'Add Entry'
on_release: root.add_new_entry()
Button:
size_hint_y: None
height: '65dp'
text: 'Delete Entry'


Here are the classes for building the app and the methods for retrieving/updating the list adapter along with all of my imports. Also the diary_reader import is another class that generates lists and dictionaries from .csv files



import kivy
kivy.require('1.10.1')
from kivy.app import App
from kivy.lang import Builder
from kivy.adapters.listadapter import ListAdapter
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.listview import ListItemButton
from diary_reader import *
from kivy.properties import ObjectProperty

diary_dict = give_completed_dict()
displayed_diary = return_as_list_keys(diary_dict)

class HomeScreen(Screen):
pass


class DiaryScreen(Screen):
date_input_field = ObjectProperty()
group_input_field = ObjectProperty()

def __init__(self, **kwargs):
self.DiaryAdapter = ListAdapter(data=displayed_diary,
cls=ListItemButton)
super(DiaryScreen, self).__init__(**kwargs)

def get_date(self):
the_date = self.date_input_field.text
return the_date

def get_group(self):
the_group = self.group_input_field.text
return the_group

def get_key(self):
d = self.get_date()
g = self.get_group()
new_key = d + ' ' + g
return new_key

def add_new_entry(self):
k = self.get_key()
self.DiaryAdapter.adapter.data.extend([k])
self.DiaryAdapter._trigger_reset_populate()

screen_manager = ScreenManager()
screen_manager.add_widget(HomeScreen(name='home_screen'))
screen_manager.add_widget(DiaryScreen(name='diary_screen'))

class My_GymApp(App):
def build(self):
return screen_manager


if __name__ == '__main__':
My_GymApp().run()


I read the documentation for adapters and listadapters on kivy's website but I still couldn't really figure out what was causing this error.



in add_new_entry
self.DiaryAdapter.adapter.data.extend([k])
AttributeError: 'ListAdapter' object has no attribute 'adapter'










share|improve this question














I recently started learning kivy and when trying to update the ListView I get the error AttributeError: 'ListAdapter' object has no attribute 'adapter'. I was wondering what the logic behind this error is and what I can do to fix it.



Here is the kv text



Builder.load_string("""
#:import ListItemButton kivy.uix.listview.ListItemButton
<HomeScreen>:
BoxLayout:
orientation: 'vertical'
padding: 30
spacing: 30
BoxLayout:
Label:
font_size: 48
text: 'Welcome To Your Gym App'
BoxLayout:
Button:
text: 'Diary'
on_release: root.manager.current = 'diary_screen'

<DiaryScreen>:
date_input_field: date_input_field
group_input_field: group_input_field
BoxLayout:
spacing: 30
padding: 30
orientation: 'vertical'
ListView:
adapter: root.DiaryAdapter
BoxLayout:
size_hint_y: .07
Label:
text: 'Date:'
TextInput:
id: date_input_field
multiline: False
BoxLayout:
size_hint_y: .07
Label:
text: 'Group:'
TextInput:
id: group_input_field
multiline: False
BoxLayout:
size_hint_y: .2
orientation: 'horizontal'
Button:
size_hint_y: None
height: '65dp'
text: 'Back'
on_release: root.manager.current = 'home_screen'
Button:
size_hint_y: None
height: '65dp'
text: 'Edit Entry'
Button:
size_hint_y: None
height: '65dp'
text: 'Add Entry'
on_release: root.add_new_entry()
Button:
size_hint_y: None
height: '65dp'
text: 'Delete Entry'


Here are the classes for building the app and the methods for retrieving/updating the list adapter along with all of my imports. Also the diary_reader import is another class that generates lists and dictionaries from .csv files



import kivy
kivy.require('1.10.1')
from kivy.app import App
from kivy.lang import Builder
from kivy.adapters.listadapter import ListAdapter
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.listview import ListItemButton
from diary_reader import *
from kivy.properties import ObjectProperty

diary_dict = give_completed_dict()
displayed_diary = return_as_list_keys(diary_dict)

class HomeScreen(Screen):
pass


class DiaryScreen(Screen):
date_input_field = ObjectProperty()
group_input_field = ObjectProperty()

def __init__(self, **kwargs):
self.DiaryAdapter = ListAdapter(data=displayed_diary,
cls=ListItemButton)
super(DiaryScreen, self).__init__(**kwargs)

def get_date(self):
the_date = self.date_input_field.text
return the_date

def get_group(self):
the_group = self.group_input_field.text
return the_group

def get_key(self):
d = self.get_date()
g = self.get_group()
new_key = d + ' ' + g
return new_key

def add_new_entry(self):
k = self.get_key()
self.DiaryAdapter.adapter.data.extend([k])
self.DiaryAdapter._trigger_reset_populate()

screen_manager = ScreenManager()
screen_manager.add_widget(HomeScreen(name='home_screen'))
screen_manager.add_widget(DiaryScreen(name='diary_screen'))

class My_GymApp(App):
def build(self):
return screen_manager


if __name__ == '__main__':
My_GymApp().run()


I read the documentation for adapters and listadapters on kivy's website but I still couldn't really figure out what was causing this error.



in add_new_entry
self.DiaryAdapter.adapter.data.extend([k])
AttributeError: 'ListAdapter' object has no attribute 'adapter'







python-3.x oop kivy listadapter






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 21 '18 at 16:10









vloverovlovero

185




185








  • 1





    ListAdapter does not have an adapter attribute, perhaps you meant self.DiaryAdapter.data.extend([k])?

    – John Anderson
    Nov 21 '18 at 21:42













  • Yep that was this issue and now it works perfectly, thanks!

    – vlovero
    Nov 21 '18 at 22:53














  • 1





    ListAdapter does not have an adapter attribute, perhaps you meant self.DiaryAdapter.data.extend([k])?

    – John Anderson
    Nov 21 '18 at 21:42













  • Yep that was this issue and now it works perfectly, thanks!

    – vlovero
    Nov 21 '18 at 22:53








1




1





ListAdapter does not have an adapter attribute, perhaps you meant self.DiaryAdapter.data.extend([k])?

– John Anderson
Nov 21 '18 at 21:42







ListAdapter does not have an adapter attribute, perhaps you meant self.DiaryAdapter.data.extend([k])?

– John Anderson
Nov 21 '18 at 21:42















Yep that was this issue and now it works perfectly, thanks!

– vlovero
Nov 21 '18 at 22:53





Yep that was this issue and now it works perfectly, thanks!

– vlovero
Nov 21 '18 at 22:53












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416146%2fhow-does-this-error-happen-attributeerror-listadapter-object-has-no-attribut%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416146%2fhow-does-this-error-happen-attributeerror-listadapter-object-has-no-attribut%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Create new schema in PostgreSQL using DBeaver

Deepest pit of an array with Javascript: test on Codility

Costa Masnaga