Two Books About the Kivy GUI Framework

The Kivy Python GUI framework is intriguing.

Not only it’s cross-platform but also supports Android. Java is too verbose and low level for me and Kivy is an opportunity for developing native Android apps without leaving Python.

Outside of the Kivy project documentation, there are few third-party advanced tutorials that go in more depth than the official tutorials. So, before diving into the code of the Kivy demos, I wanted some books to explore more features and get a broader picture of the framework and what it can do.

I found two potentially interesting books: Building Android Apps in Python Using Kivy with Android Studio: With Pyjnius, Plyer, and Buildozer by Ahmed Fawzy Mohamed Gad (Apress, 2019), and Kivy - Interactive Applications and Games in Python - Second Edition by Roberto Ulloa (Packt, 2015).

I read both and here are my impressions.

Building Android Apps in Python Using Kivy with Android Studio

I had much hope for Building Android Apps in Python Using Kivy with Android Studio as its focus is Android. And it was published just a few weeks ago, so it may be the most up to date of the books about the framework.

But I don’t recommend the book.

Cover of Building Android Apps in Python Using Kivy with Android Studio in Google Play Books on a Pixel 2 XL
The cover of Building Android Apps in Python Using Kivy with Android Studio in Google Play Books on my Pixel 2 XL.

It’s poorly edited, often repetitive, and, despite the size, covers only a handful of widgets, layouts, and Kivy features. The few interesting tidbits here and there aren't worth the price.

As a non-native English speaker and author I face the same difficulties in writing about complex technical topics in an unfamiliar language. Had the book been self-published, I wouldn’t have minded some editing issues. But I hold a large publishing house to higher standards.

The book presents a few sample apps it progressively builds on and enhances. In most cases, each new version includes the full source code of the previous versions, which sometimes makes it difficult to spot new or changed features. This, along with the poor editing, makes reading bumpy.

Kivy with Android Studio is an oxymoron. The point of using Python to develop Android apps is to not have to use Java, so this part of the book is useless to me. I’d prefer more examples of what Plyer can do without Java.

Despite all this, the author knows his stuff. I hope for a new, improved edition that keeps the focus on Android and Python, tells how to make apps responsive on a variety of screens, expands on Plyer, and drops Java.

Update

The author of Building Android Apps in Python Using Kivy with Android Studio, Ahmed Fawzy Mohamed Gad, emailed me to provide more context on how he researched and planned the book. His comments are interesting and explain the rationale behind his content selection decisions.

Thanks to Ahmed for sharing his thoughts.

Kivy - Interactive Applications and Games in Python

Kivy - Interactive Applications and Games in Python is the learning resource I was looking for.

At over half the size of Gad’s book, Ulloa’s is much better. It covers many more Kivy features that help develop complex, attractive, responsive apps with a wide variety of layouts and widgets.

Cover of Kivy - Interactive Applications and Games in Python in Google Play Books on a Pixel 2 XL
The cover of Kivy - Interactive Applications and Games in Python in Google Play Books on my Pixel 2 XL.

Aside from a game, the book discusses apps that showcase several advanced widgets and features of desktop and mobile user interfaces. The sample apps display fairly complex data, have a variety of user interface controls, and showcase different interaction techniques.

Ulloa anticipates the learning roadblocks and difficulties and clarifies some subtleties of Kivy. For example, code like this in the KV file of Kivy’s reStructured Text editor demo had me puzzled as it has the same identifier at both sides of a statement:

Root:
    text_input: text_input

Ulloa explains the left one is a widget attribute, the right one a widget ID. To avoid confusion, he uses a different style in which IDs start with an underscore, like this in the previous example:

Root:
    text_input: _text_input

According to the Kivy blog’s review of Kivy – Interactive Applications and Games in Python, the chapter on events and event binding is dense and difficult to grok. As a Kivy and Python beginner this wasn’t my impression. However, the coordinate transformations that event handlers often perform may be difficult to visualize.

The code fragments are often short and easy to follow but the book has a formatting issue that interferes with reading the code. In the ePub version of the ebook I bought at Google Play Books, the width of source code blocks is too narrow and most of the lines wrap.

Ulloa’s book covers enough building blocks to bootstrap my understanding of Kivy and continue on my own.

Popular posts from this blog

Using a Bluetooth Keyboard on Android

An Intel 8080 Assembly Suite in Python

Reading PDF Ebooks with Google Play Books