There are several GUI frameworks for Python. Most of them are for desktop applications. Kivy is an exception. Using it you can build project for mobile platforms. Unfortunately, it is not production ready. You have to juggle versions of libraries to make it works. So even having a t-shirt that says
print("Python is my favorite language") I have to accept that Python is not for mobile development.
Ok. You have to do the same things for web applications. But in this case, you have to manage python dependencies only (in 99% of cases) or you can control your environment. Basically, you can build a docker image as you want with any libraries you need. But Kivy brings a lot of binary dependencies that should be installed using platform-specific external tools. And now you can’t control the environment. And this changes everything.
Recently I decided to build a small QR-code reading app for Android. I’m using Python every day, so I had no reasons not to use Kivy. And a couple of hours later I had a desktop application that worked quite well.
from kivy.app import App from kivy.lang import Builder from zbarcam.zbarcam import zbarcam DEMO_APP_KV_LANG = """ BoxLayout: orientation: 'vertical' ZBarCam: id: zbarcam code_types: 'qrcode', 'ean13' Label: size_hint: None, None size: self.texture_size, 50 text: 'test: ' + ', '.join([str(symbol.data) for symbol in zbarcam.symbols]) """ class DemoApp(App): def build(self): return Builder.load_string(DEMO_APP_KV_LANG) if __name__ == '__main__': DemoApp().run()
Actually, I spent 5 minutes to find and copy-paste this snippet and 1 hour 55 minutes to make it work. I supposed that it should take 10-15 minutes maximum. Because of the problem with a binary dependency, zbarcam from kivy-garden was too old and didn't work. And then I’ve spent 2 days trying to build an android project. Without any success. I failed to find working pair versions for Kivy and Cython.
I decided to stop there. I love Python, but there are more stable technologies to make the thing done. Event Cordova and JS suit this task much better. They are more mature, and stable. Xamarin another good option. Do not use technology in a field where it doesn’t work just because you know it.
Got a question? Hit me on Twitter: avkorablev