Hi, new to python and desperately trying to import Tkinter to Pythonista, can anyone help?
I couldn’t find anything on here except a 5year old post saying its not possible, is this still true?
I tried a few different import commands that didn’t work and tried looking for a tkinter.zip on web but no luck, asking this question is my last resort.
You can’t use tkinter in Pythonista, as of now. And, most likely, never.
@upwart cheers for info, is there a technical reason for this? I’m curious.
@brumm cheers for the alternative, I will get it. Wondering if I can use that across other platforms or is it restricted to iOS? I’m only developing on my ipad out of current necessity. Also curious are you from Brum?
uimodule is specific to Pythonista, you cannot use it on other systems. It's also heavily based on the iOS
UIKitframework, so it wouldn't be very easy to port (especially to non-Apple platforms).
Hi scatter, no I'm not from Birmingham.
to hum => brummen
@scatter it is fairly easy to write cross UI platforms applications that run unmodified at the source code level on all major GUIs using python. That is if you plan to use specific UI elements and not trying to create warpers around a platform from the standpoint of another. I have published scripts in this forum (refer to this thread) that demonstrate the matter with fully functional modules. They cover the basic UI elements that (arguably) form the basis of most applications. They cover the Pythonista UI matched with the Kivy GUI. Integrating Tkinter maybe a little more complicated since it does not closely follow the same syntax structure as the others. However, it can be done with not much pain if you really want to go that route. Here is a simple demo that covers basic geometric forms and integrates all three GUIs automatically. I also developed a graphic designer that speeds up the coding of the interface that you may find here. Hope this helps.
TKInter is a desktop GUI module that accepts mouse input, while the iPhone is a touch based UI. This means there are some interactions and gestures that don't map across between them. For example the phone interface has no analogue of right-click or click-and-drag. Similarly the desktop interaction model has no analogue of a long-press or swipe.
You can arbitrarily try and assign mappings between some of these, so you could say long press equals right-click, but that might work fine in one application but poorly in another in which long-click might need to be used for another gesture such as to select something for drag-and-drop. No one mapping will work for every application, but at the framework level to make something portable you'd need to have fixed mappings.
Then you have the issue that the phone doesn't have a concept of floating windows, re-sizable windows, overlapping windows, floating dialogs and menus, scroll bars and many others. How do you do shift-click or control-click on a phone? Conversely on the phone you have conventions like swiping from the edge of the screen and multi-touch gestures. There are very good reasons why even Apple's own OSX GUI framework was not ported directly to iOS.
It is possible to write UI toolkits from scratch that are designed to map across between touch and desktop paradigms. The way to do this is to identify a subset of gestures and interactions in both models and creating strict mappings between them at the toolkit level. This gives you the portability, but at a cost of sacrificing the ability to use interactions that can't be deterministic-ally mapped to the other platforms. Unfortunately TKInter wasn't designed in terms of sacrificing desktop GUI capabilities in order to make the subset portable to phones, so it has a lot of GUI paradigm interactions and display widgets included that don't port over.