Getting ListView to work in .kv files

540 views
Skip to first unread message

woolly.t...@gmail.com

unread,
Feb 19, 2013, 9:11:32 PM2/19/13
to kivy-...@googlegroups.com
Hi everyone! I'm new to Kivy and have been bashing my head against this problem for a few hours now. I've read the list view documentation along with its source code and exhausted my google-fu. 

How do you get ListView to work in a .kv file? The two solutions given in examples, list_simple_in_kv.py and list_simple_in_kv_2.py, cause an error in python. I've attached the program output as error.txt. Essentially, ListView raises an exception, "item_strings needed or an adapter". I get the same error when I try to implement a basic list in a Kivy file, like so:
 ListView:
      item_strings
:[str(index) for index in xrange(100)]
raises exception "item_strings needed or an adapter".

Can anyone shed light on what is going on here? How are you supposed to implement a ListView in a .kv file?

Kivy 1.5.1, mobile installation
Python 2.7.3
error.txt

Jeff Pittman

unread,
Feb 20, 2013, 3:04:21 AM2/20/13
to kivy-...@googlegroups.com
Fixed in master I think, but please see https://github.com/kivy/kivy/issues/970 and confirm that we are running the same example.

Thanks,

Jeff

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
<error.txt>

James Kwan

unread,
Mar 5, 2013, 4:12:35 PM3/5/13
to kivy-...@googlegroups.com
Hi I'm new and am having the same problem what does it mean to use the master?

krister viirsaar

unread,
Mar 5, 2013, 4:48:04 PM3/5/13
to kivy-...@googlegroups.com
"fixed in master" I think (i'm not super knowledgeable) means they fixed this issue in the main program. This means it wasn't the users problem, but Kivys.

Sam Brotherton

unread,
Mar 5, 2013, 4:53:45 PM3/5/13
to kivy-...@googlegroups.com
When you work on a project using git (which kivy uses), you generally organize your code into branches so that you can work on new features/bug fixes without breaking the main copy. master is the git branch that is supposed to always contain a working, stable copy of the program. So generally they'll work on a feature in some other branch, and then when it is 100% ready and tested they'll merge that branch into master. If you go to https://github.com/kivy/kivy and click on the button that says branch:master, you can see all the other branches that are being worked on.

Source control is a really good thing; you should start using it!


On Tue, Mar 5, 2013 at 1:48 PM, krister viirsaar <krister....@gmail.com> wrote:
"fixed in master" I think (i'm not super knowledgeable) means they fixed this issue in the main program. This means it wasn't the users problem, but Kivys.

James Kwan

unread,
Mar 5, 2013, 5:19:29 PM3/5/13
to kivy-...@googlegroups.com
So then if it is fixed how do I get it to work in my code? Do I need to re-install kivy?


On Tuesday, February 19, 2013 9:11:32 PM UTC-5, woolly.t...@gmail.com wrote:

Sam Brotherton

unread,
Mar 5, 2013, 5:22:04 PM3/5/13
to kivy-...@googlegroups.com
depends on how you installed kivy in the first place, and what OS you're using. If you're on linux, just go to a directory and run

sudo pip uninstall kivy
cd kivy
sudo python setup.py install

And you should be good to go.


--

James Kwan

unread,
Mar 5, 2013, 5:42:11 PM3/5/13
to kivy-...@googlegroups.com
Sorry I forgot to mention that I'm on Win 7. I installed kivy using the package on the site for Windows.

Gabriel Pettier

unread,
Mar 5, 2013, 7:33:25 PM3/5/13
to kivy-...@googlegroups.com
then either you wait for the new release, or you upgrade your kivy
install using this procedure:
http://kivy.org/docs/installation/installation-windows.html#use-development-kivy

cheers

On Tue, Mar 05, 2013 at 02:42:11PM -0800, James Kwan wrote:
> Sorry I forgot to mention that I'm on Win 7. I installed kivy using the
> package on the site for Windows.
>
> On Tuesday, March 5, 2013 5:22:04 PM UTC-5, Sam Brotherton wrote:
> >
> > depends on how you installed kivy in the first place, and what OS you're
> > using. If you're on linux, just go to a directory and run
> >
> > sudo pip uninstall kivy
> > git clone https://github.com/kivy/kivy.git
> > cd kivy
> > sudo python setup.py install
> >
> > And you should be good to go.
> >
> >
> > On Tue, Mar 5, 2013 at 2:19 PM, James Kwan <kwanj...@gmail.com<javascript:>
> > > wrote:
> >
> >> So then if it is fixed how do I get it to work in my code? Do I need to
> >> re-install kivy?
> >>
> >>
> >> On Tuesday, February 19, 2013 9:11:32 PM UTC-5, woolly.t...@gmail.comwrote:
> >>
> >>> Hi everyone! I'm new to Kivy and have been bashing my head against this
> >>> problem for a few hours now. I've read the list view documentation
> >>> <http://kivy.org/docs/api-kivy.uix.listview.html>along with its source
> >>> code and exhausted my google-fu.
> >>>
> >>> How do you get ListView to work in a .kv file? The two solutions given
> >>> in examples, list_simple_in_kv.py<https://github.com/kivy/kivy/blob/master/examples/widgets/lists/list_simple_in_kv.py>and
> >>> list_simple_in_kv_2.py<https://github.com/kivy/kivy/blob/master/examples/widgets/lists/list_simple_in_kv_2.py>,
> >>> cause an error in python. I've attached the program output as error.txt.
> >>> Essentially, ListView raises an exception, "item_strings needed or an
> >>> adapter". I get the same error when I try to implement a basic list in a
> >>> Kivy file, like so:
> >>> ListView:
> >>> item_strings:[str(index) for index in xrange(100)]
> >>> raises exception "item_strings needed or an adapter".
> >>>
> >>> Can anyone shed light on what is going on here? How are you supposed to
> >>> implement a ListView in a .kv file?
> >>>
> >>> Kivy 1.5.1, mobile installation
> >>> Python 2.7.3
> >>>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Kivy users support" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an
> >> email to kivy-users+...@googlegroups.com <javascript:>.

James Kwan

unread,
Mar 6, 2013, 9:09:03 AM3/6/13
to kivy-...@googlegroups.com
Thanks for all the help.
Reply all
Reply to author
Forward
0 new messages