Tkinter on Android?
Posted by NoBeginning2551@reddit | Python | View on Reddit | 9 comments
I'm building a mini IDE for Android, you can see detail here:
https://www.reddit.com/r/vscode/s/8sxZYOa4Hf
I know tkinter isn't supported on Android by default. But is there any workaround? Like how does it work on the pydroid app?
Even if I cross compile TCL and Tk with ndk, how to get the display server, like the X11 and wayland on desktop?
Python-ModTeam@reddit
Hi there, from the /r/Python mods.
We have removed this post as it is not suited to the /r/Python subreddit proper, however it should be very appropriate for our sister subreddit /r/LearnPython or for the r/Python discord: https://discord.gg/python.
The reason for the removal is that /r/Python is dedicated to discussion of Python news, projects, uses and debates. It is not designed to act as Q&A or FAQ board. The regular community is not a fan of "how do I..." questions, so you will not get the best responses over here.
On /r/LearnPython the community and the r/Python discord are actively expecting questions and are looking to help. You can expect far more understanding, encouraging and insightful responses over there. No matter what level of question you have, if you are looking for help with Python, you should get good answers. Make sure to check out the rules for both places.
Warm regards, and best of luck with your Pythoneering!
spinwizard69@reddit
OK, why not run real Linux on your device? I only ask because tkinter has been a Linux / Unix thing for many many years now. That means very few glitches, things just work.
Wise_Slate8295@reddit
That's a decent idea, though dealing with a full Linux distro on a phone has its own quirks. I've tried it, and UI scaling can be a real pain depending on the device.
NoBeginning2551@reddit (OP)
Actually it's an android code editor app, made with flutter. When user clicks on the run button, it runs the code. I cross compiled python interpreter for Android. But the tkinter module is not included with the arm64-android-linix build of python. Android uses a different mechanism for displaying GUI, so traditional tkinter won't work. So I was asking for any workaround like in the pydroid app.
spinwizard69@reddit
Yeah that is the problem with writing Android code. I never liked it as an OS for anything bigger than a phone.
Forsaken-Medium-2436@reddit
I haven't done it myself but from what I recall briefcase support native UI and works on all platforms
NoBeginning2551@reddit (OP)
I think briefcase is used to convert python projects to executable. But my case is different. I have the cross compiled python interpreter inside my android app. When the user click run button, it executes the code and shows the output on the terminal. Like the pydroid app. But the problem is that the android build of python doesn't have the tkinter. I don't know how the pydroid team managed to make it work.
Forsaken-Medium-2436@reddit
I don't really understand what are you doing, I'm assuming you're trying to build some python app and deploy it on android, so briefcase is just that, you write in python everything from start to end including GUI and compile in for all platforms at once. Otherwise I was mistaken and can't really help you
NoBeginning2551@reddit (OP)
Sorry, I haven't explained it well. Actually it's an android code editor app built with flutter. We can edit and run python code inside that. But the tkinter module is not working. That was the issue.