TypeError: 'kivy.weakproxy.WeakProxy' object is not callable Kivi











up vote
1
down vote

favorite












I'm new to kivy, and I'm to write a viewer app.
Currently I'm working on the design alone, but I'm getting the following error:
line 239, in create_view
view_instance = cls(**item_args) TypeError: 'kivy.weakproxy.WeakProxy' object is not callable



Sharing my code:



bins_player.py:



import kivy
import glob
from os import path
import tkinter as tk
from kivy.app import App
from tkinter import filedialog
from kivy.core.window import Window
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty
from kivy.uix.gridlayout import GridLayout

kivy.require('1.9.0')

class FilesPanel(GridLayout):
frames_list = ObjectProperty()

def open_files(self):
root = tk.Tk()
root.withdraw()

self.load_files(filedialog.askdirectory(parent=root,initialdir="/", title='Please select a directory'))

def load_files(self, selected_folder):
all_bin_files = glob.glob(path.join(selected_folder, '*.bin'))

for bin_file in all_bin_files:
self.frames_list.adapter.data.extend([bin_file])
self.frames_list._trigger_reset_populate()


class BinsPlayerMain(GridLayout):
pass


class Bins_PlayerApp(App):
def build(self):
Window.clearcolor = (1, 1, 1, 1)
self.title = 'Bins Player'
self.icon = 'BinsPlayer.ico'
return BinsPlayerMain()


if __name__ == "__main__":
Bins_PlayerApp().run()


bins_player.kv:



#: include ui/filespanel.kv

<BinsPlayerMain>:
rows: 2

GridLayout:


filespanel.kv:



#: include force ui/sectiontitle.kv
#: import ListAdapter kivy.adapters.listadapter.ListAdapter

<FilesPanel>:
id: filesPanel
frames_list: frames_list_view
rows: 2
size_hint_x: None
width: 200

ListView:
id: frames_list_view
rgba: .2, .2, .2, 1
adapter:
ListAdapter(data=, cls=filesPanel)

Button:
size_hint_y: None
height: 30
spacing: 10
text: 'Open Folder'
on_press: filesPanel.open_files()


I'm getting this error right after I'm opening a folder - after the ListView gets updated.



What could be the problem here?



I saw a new layout called ResycleView - can this be used here instead of the ListView?










share|improve this question






















  • the cls parameter in your filespanel.kv should be a class, but you are passing a kivy.weakproxy.WeakProxy (that is what the id filesPanel1 actually is).
    – John Anderson
    Nov 4 at 14:53












  • Then I should pass the FilesPanel class instead? If I do that I get an error NameError: name 'FilesPanel' is not defined
    – Idanis
    2 days ago










  • No FilesPanel is not the class you want. The cls parameter is a class that will be used to display each element in the ListView. A simple one is ListItemLabel. And yes, you can use RecycleView, in fact, ListView is deprecated in favor of RecycleView. See the documentation.
    – John Anderson
    2 days ago















up vote
1
down vote

favorite












I'm new to kivy, and I'm to write a viewer app.
Currently I'm working on the design alone, but I'm getting the following error:
line 239, in create_view
view_instance = cls(**item_args) TypeError: 'kivy.weakproxy.WeakProxy' object is not callable



Sharing my code:



bins_player.py:



import kivy
import glob
from os import path
import tkinter as tk
from kivy.app import App
from tkinter import filedialog
from kivy.core.window import Window
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty
from kivy.uix.gridlayout import GridLayout

kivy.require('1.9.0')

class FilesPanel(GridLayout):
frames_list = ObjectProperty()

def open_files(self):
root = tk.Tk()
root.withdraw()

self.load_files(filedialog.askdirectory(parent=root,initialdir="/", title='Please select a directory'))

def load_files(self, selected_folder):
all_bin_files = glob.glob(path.join(selected_folder, '*.bin'))

for bin_file in all_bin_files:
self.frames_list.adapter.data.extend([bin_file])
self.frames_list._trigger_reset_populate()


class BinsPlayerMain(GridLayout):
pass


class Bins_PlayerApp(App):
def build(self):
Window.clearcolor = (1, 1, 1, 1)
self.title = 'Bins Player'
self.icon = 'BinsPlayer.ico'
return BinsPlayerMain()


if __name__ == "__main__":
Bins_PlayerApp().run()


bins_player.kv:



#: include ui/filespanel.kv

<BinsPlayerMain>:
rows: 2

GridLayout:


filespanel.kv:



#: include force ui/sectiontitle.kv
#: import ListAdapter kivy.adapters.listadapter.ListAdapter

<FilesPanel>:
id: filesPanel
frames_list: frames_list_view
rows: 2
size_hint_x: None
width: 200

ListView:
id: frames_list_view
rgba: .2, .2, .2, 1
adapter:
ListAdapter(data=, cls=filesPanel)

Button:
size_hint_y: None
height: 30
spacing: 10
text: 'Open Folder'
on_press: filesPanel.open_files()


I'm getting this error right after I'm opening a folder - after the ListView gets updated.



What could be the problem here?



I saw a new layout called ResycleView - can this be used here instead of the ListView?










share|improve this question






















  • the cls parameter in your filespanel.kv should be a class, but you are passing a kivy.weakproxy.WeakProxy (that is what the id filesPanel1 actually is).
    – John Anderson
    Nov 4 at 14:53












  • Then I should pass the FilesPanel class instead? If I do that I get an error NameError: name 'FilesPanel' is not defined
    – Idanis
    2 days ago










  • No FilesPanel is not the class you want. The cls parameter is a class that will be used to display each element in the ListView. A simple one is ListItemLabel. And yes, you can use RecycleView, in fact, ListView is deprecated in favor of RecycleView. See the documentation.
    – John Anderson
    2 days ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm new to kivy, and I'm to write a viewer app.
Currently I'm working on the design alone, but I'm getting the following error:
line 239, in create_view
view_instance = cls(**item_args) TypeError: 'kivy.weakproxy.WeakProxy' object is not callable



Sharing my code:



bins_player.py:



import kivy
import glob
from os import path
import tkinter as tk
from kivy.app import App
from tkinter import filedialog
from kivy.core.window import Window
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty
from kivy.uix.gridlayout import GridLayout

kivy.require('1.9.0')

class FilesPanel(GridLayout):
frames_list = ObjectProperty()

def open_files(self):
root = tk.Tk()
root.withdraw()

self.load_files(filedialog.askdirectory(parent=root,initialdir="/", title='Please select a directory'))

def load_files(self, selected_folder):
all_bin_files = glob.glob(path.join(selected_folder, '*.bin'))

for bin_file in all_bin_files:
self.frames_list.adapter.data.extend([bin_file])
self.frames_list._trigger_reset_populate()


class BinsPlayerMain(GridLayout):
pass


class Bins_PlayerApp(App):
def build(self):
Window.clearcolor = (1, 1, 1, 1)
self.title = 'Bins Player'
self.icon = 'BinsPlayer.ico'
return BinsPlayerMain()


if __name__ == "__main__":
Bins_PlayerApp().run()


bins_player.kv:



#: include ui/filespanel.kv

<BinsPlayerMain>:
rows: 2

GridLayout:


filespanel.kv:



#: include force ui/sectiontitle.kv
#: import ListAdapter kivy.adapters.listadapter.ListAdapter

<FilesPanel>:
id: filesPanel
frames_list: frames_list_view
rows: 2
size_hint_x: None
width: 200

ListView:
id: frames_list_view
rgba: .2, .2, .2, 1
adapter:
ListAdapter(data=, cls=filesPanel)

Button:
size_hint_y: None
height: 30
spacing: 10
text: 'Open Folder'
on_press: filesPanel.open_files()


I'm getting this error right after I'm opening a folder - after the ListView gets updated.



What could be the problem here?



I saw a new layout called ResycleView - can this be used here instead of the ListView?










share|improve this question













I'm new to kivy, and I'm to write a viewer app.
Currently I'm working on the design alone, but I'm getting the following error:
line 239, in create_view
view_instance = cls(**item_args) TypeError: 'kivy.weakproxy.WeakProxy' object is not callable



Sharing my code:



bins_player.py:



import kivy
import glob
from os import path
import tkinter as tk
from kivy.app import App
from tkinter import filedialog
from kivy.core.window import Window
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty
from kivy.uix.gridlayout import GridLayout

kivy.require('1.9.0')

class FilesPanel(GridLayout):
frames_list = ObjectProperty()

def open_files(self):
root = tk.Tk()
root.withdraw()

self.load_files(filedialog.askdirectory(parent=root,initialdir="/", title='Please select a directory'))

def load_files(self, selected_folder):
all_bin_files = glob.glob(path.join(selected_folder, '*.bin'))

for bin_file in all_bin_files:
self.frames_list.adapter.data.extend([bin_file])
self.frames_list._trigger_reset_populate()


class BinsPlayerMain(GridLayout):
pass


class Bins_PlayerApp(App):
def build(self):
Window.clearcolor = (1, 1, 1, 1)
self.title = 'Bins Player'
self.icon = 'BinsPlayer.ico'
return BinsPlayerMain()


if __name__ == "__main__":
Bins_PlayerApp().run()


bins_player.kv:



#: include ui/filespanel.kv

<BinsPlayerMain>:
rows: 2

GridLayout:


filespanel.kv:



#: include force ui/sectiontitle.kv
#: import ListAdapter kivy.adapters.listadapter.ListAdapter

<FilesPanel>:
id: filesPanel
frames_list: frames_list_view
rows: 2
size_hint_x: None
width: 200

ListView:
id: frames_list_view
rgba: .2, .2, .2, 1
adapter:
ListAdapter(data=, cls=filesPanel)

Button:
size_hint_y: None
height: 30
spacing: 10
text: 'Open Folder'
on_press: filesPanel.open_files()


I'm getting this error right after I'm opening a folder - after the ListView gets updated.



What could be the problem here?



I saw a new layout called ResycleView - can this be used here instead of the ListView?







python python-3.x pycharm kivy kivy-language






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 4 at 10:11









Idanis

79942150




79942150












  • the cls parameter in your filespanel.kv should be a class, but you are passing a kivy.weakproxy.WeakProxy (that is what the id filesPanel1 actually is).
    – John Anderson
    Nov 4 at 14:53












  • Then I should pass the FilesPanel class instead? If I do that I get an error NameError: name 'FilesPanel' is not defined
    – Idanis
    2 days ago










  • No FilesPanel is not the class you want. The cls parameter is a class that will be used to display each element in the ListView. A simple one is ListItemLabel. And yes, you can use RecycleView, in fact, ListView is deprecated in favor of RecycleView. See the documentation.
    – John Anderson
    2 days ago


















  • the cls parameter in your filespanel.kv should be a class, but you are passing a kivy.weakproxy.WeakProxy (that is what the id filesPanel1 actually is).
    – John Anderson
    Nov 4 at 14:53












  • Then I should pass the FilesPanel class instead? If I do that I get an error NameError: name 'FilesPanel' is not defined
    – Idanis
    2 days ago










  • No FilesPanel is not the class you want. The cls parameter is a class that will be used to display each element in the ListView. A simple one is ListItemLabel. And yes, you can use RecycleView, in fact, ListView is deprecated in favor of RecycleView. See the documentation.
    – John Anderson
    2 days ago
















the cls parameter in your filespanel.kv should be a class, but you are passing a kivy.weakproxy.WeakProxy (that is what the id filesPanel1 actually is).
– John Anderson
Nov 4 at 14:53






the cls parameter in your filespanel.kv should be a class, but you are passing a kivy.weakproxy.WeakProxy (that is what the id filesPanel1 actually is).
– John Anderson
Nov 4 at 14:53














Then I should pass the FilesPanel class instead? If I do that I get an error NameError: name 'FilesPanel' is not defined
– Idanis
2 days ago




Then I should pass the FilesPanel class instead? If I do that I get an error NameError: name 'FilesPanel' is not defined
– Idanis
2 days ago












No FilesPanel is not the class you want. The cls parameter is a class that will be used to display each element in the ListView. A simple one is ListItemLabel. And yes, you can use RecycleView, in fact, ListView is deprecated in favor of RecycleView. See the documentation.
– John Anderson
2 days ago




No FilesPanel is not the class you want. The cls parameter is a class that will be used to display each element in the ListView. A simple one is ListItemLabel. And yes, you can use RecycleView, in fact, ListView is deprecated in favor of RecycleView. See the documentation.
– John Anderson
2 days ago

















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',
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%2f53139681%2ftypeerror-kivy-weakproxy-weakproxy-object-is-not-callable-kivi%23new-answer', 'question_page');
}
);

Post as a guest





































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53139681%2ftypeerror-kivy-weakproxy-weakproxy-object-is-not-callable-kivi%23new-answer', 'question_page');
}
);

Post as a guest




















































































這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini