The Return of Tinypapers

 

 

 

progress

 

It’s not the prettiest right now, but I got tinypapers to do something. It doesn’t seem very impressive, but the data structures behind it are pretty complex, this part of Kivy is still under development, the documentation they have isn’t the easiest to read, and the answers on the Internet are basically all different.

What it does is take input, add it to a special sort of string array, and hand it off to a really complex little widget that makes the array into those green buttons. The complex widget involved is still experimental code and the syntax for getting it to work isn’t easily understood.

After groveling through a whole bunch of Internet stuff, I came back to Kivy’s ListView documentation and for whatever reason, I was able to understand it more.

For those who want to know, here’s how to declare a ListAdapter and write its args_converter in KVlang:

adapter:
ListAdapter(data=[“{0}”.format(i) for i in root.button_list_entries], cls=ListItemButton)

In actual code files, you’ll want to break that up into more lines. It’s certainly more than eighty characters long, just put on one line here for readability.

I may end up refactoring this later and writing the args_converter in the Python file or something; I’m kind of meh about having this Python code stuck in the middle of a KVlang file, even though it’s just a function call. That’s okay for now, though. I’m more concerned about getting the prototype to work; I’ll worry about refactoring and things like correcting my (very likely non-canonical) indentation style later or if it becomes a problem.

Here’s a quick visual demo of what I got the thing to do:

Screen Shot 2015-08-01 at 3.40.50 PM

 

The nice UI colors from before will eventually come back, don’t worry–I’m not neglecting the interface or anything. This is just more important right now.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s