Python Training by Dan Bader

Using Python for Mobile Development: Kivy vs BeeWare

Mobile application development on Android and iOS wasn’t Python’s strong suit in the past—but things might be changing…

Python for Mobile Development

What about using Python for mobile app development? Historically, Python didn’t have a strong story when it came to writing mobile GUI applications.

In fact, Android and iOS development was pretty much out of the question with pure Python alone. That’s a shame—

Thankfully, there have been a number of developments in recent years that vastly improved the outlook on using Python for writing mobile apps.

In this article we’ll take a look at a few modern options for mobile application development with Python. There are two frameworks I’d like to call out specifically: Kivy and the BeeWare project.

If you prefer video, check out the embedded video below with a quick five minute walkthrough of both projects and the philosophies behind them:

» Subscribe to the dbader.org YouTube Channel for more Python tutorials.

Kivy – Cross-platform Python GUIs

Kivy an open-source Python library for developing cross-platform GUI applications. It allows you to write pure-Python graphical applications that run on the main desktop platforms (Windows, Linux, and macOS) and on iOS & Android.

Now, every time I hear about a new GUI toolkit I always want to know how “native” it feels—I believe that great GUI application should play to the strengths of the platform they run on.

For example, when I’m using my iPhone I want consistency across the apps I use. It feels jarring to use an app that was designed with user interface patterns from another platform.

Kivy comes with a custom-built UI toolkit that provides it’s own versions of buttons, text labels, text entry forms, and so on. This means these widgets are not rendered using the native platform UI controls. This has pros and cons:

On the one hand this guarantees consistency and portability of your app from one platform to another. But on the other hand it also means that your Android app won’t really look and feel like an Android app…

Depending on the kind of app you have in mind, this might not be a problem at all, however. For most games, for example, the “nativeness” of the UI isn’t very important. The same is true for certain kind of niche apps like graphical MIDI controllers for making music. But for other types of apps this has a huge impact on usability.

So, if you can work with a non-native UI toolkit in your apps then Kivy is a great choice. It allows you to write mobile applications using your Python programming skills without having to learn another platform-specific language like Apple’s Swift.

You can learn more about Kivy at https://kivy.org

The BeeWare Project – Native Python Mobile Apps

The second Python GUI and mobile development framework I want to tell you about is called the “BeeWare” project. It offers you a set of tools and an abstraction layer you can use to write native-looking mobile and desktop applications using Python.

The key difference between Kivy and BeeWare is that BeeWare programs use the native UI toolkit of the platform they run on, whereas Kivy apps use a custom UI toolkit that uses the same controls across all platforms.

With BeeWare, the UI controls your app uses will be the buttons, check boxes, and form elements provided by the underlying operating system. This means you can build apps that look and feel 100% native to each specific mobile (and desktop) platform.

Sounds great, right?

The only downside is that the BeeWare project is still relatively new and currently under heavy development lead by Pythonista Russel Keith-Magee. As with any framework that hasn’t had a chance yet to mature for years this means more work for you as a developer due to (potentially frequent) API changes, bugs, and lack of features.

Nevertheless, I’d encourage you to read up on BeeWare, it’s a really exciting project. You can learn more about it here: https://pybee.org/project/using/

Pythonic Mobile App Development – Conclusion

Now, which way should you look if you want to build a mobile app with Python? Both Kivy and BeeWare are worth considering. And as far as maturity goes, Kivy seems to be the more mature platform right now.

For the use cases that I’m personally the most interested in—making native-looking mobile and desktop apps with Python—I think that BeeWare will eventually gain the upper hand, due to the “native UI controls” advantage.

But, to be honest with you, if you’re thinking about writing a great mobile app today it might not make much sense to build it with Python… If you want the best result and use state of the art platform-specific features, your best bet will be getting comfortable with Java (Android) and Swift (iOS).

However, I believe this can and will change in the future. Python’s future in the mobile dev space is looking brighter by the minute. And with Python’s rising popularity there’s a great argument to be made for using it for mobile app development.

Personally, I’d love to have the ability to write cross-platform mobile apps with Python, simply because Python is such an enjoyable language to work with.

I’m truly excited to see what the possibilities will be in a year from now. So, if you’re looking for a cool open-source project to contribute to, please consider Kivy and the BeeWare project.

You’ll help create a better future for all of us 🙂

Happy (mobile) Pythoning!

<strong><em>Improve Your Python</em></strong> with a fresh 🐍 <strong>Python Trick</strong> 💌 every couple of days

Improve Your Python with a fresh 🐍 Python Trick 💌 every couple of days

🔒 No spam ever. Unsubscribe any time.

This article was filed under: gui, mobile-development, and python.

Related Articles:
Latest Articles:
← Browse All Articles