I have a relatively simple tkinter program that just uses Event, Button and Label objects. I would like to translate this to be usable on an android platform.
1) What python for android should I use? QPython, py4a?
2) And on that platform, what GUI module should I use?
I'd like a little bit of detail for why you think a specific module or app would be best, as I'm just getting into the android scene and want to make an intelligent jump.
Unfortunately Tkinter won't work for creating mobile apps as it is meant to be used on desktop only.
You cant convert tkinter app to apk files.... python has no builtin or standard support for mobile development.
to run a tkinter program (or any Python program) on Android, you should use the app Pydroid 3 (on the play store), which has a modified tkinter module for Android and much more. To install this module, go in the app's menu > pip > quick install > tkinter .
Running the ProgramsInstall the Pydroid 3 app if needed from the Play Store. Download the book's examples package from this location to any writable folder on your phone, and unzip (i.e., extract) it. But navigate the examples-package tree to find additional tkinter code to run.
Even for native purposes, most developers would advise you keep away from Tkinter. It's a dated and unintuitive library that often makes GUI creation and maintenance harder than it needs to be.
The main advantage of developing apps using a Python library and embedding in Android is cross-platform support. These libraries will often allow you to port your app with ease to many different operating systems.
I will not answer which is "best" since this is an opinion-based question outside the scope of StackOverflow, however I will say it is (generally) easier to port from Kivy to android than it is in some other libraries (such as Qt). But take this with a grain of salt. Most libraries nowadays offer advanced GUI capabilities built-in, and your choice will likely not limit you in that regard.
Either way, there is no direct/simple way to translate your Tkinter project to any of these, and you will likely have to rewrite it with the library you end up choosing.
I will add that if your intent is developing only for android, most would advise developing in a native Android language, such as Java or Kotlin, or using a development tool which makes use of such languages. This would result in smaller APK sizes and likely faster running times for your app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With