Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Are there code samples on how to create forms and lists?
-
Are there code samples on how to create forms and lists?
Text input, sliders, switches, lists, etc?
-
At the moment, Pythonista isn't really designed for making "application" UIs. You might want to check out <a href="http://scriptk.it">ScriptKit</a>, it's more targeted towards this sort of thing.
-
Hi. I'm new to python and coding, but have been able to put together a little program. I was thinking about using Tkinter on the desktop to make UI for it, but then I got to thinking that it would be much more useful to run it in Pythonista on an iPhone. So if I understand correctly, Pythonista isn't really good for creating something with a UI ( a form with text input boxes and radio buttons)? Is that right?
Sorry if that is the same question. I just want to be sure, because it would be really cool to do this kind of stuff in Pythonista.
-
@pruppert -
<i>"Pythonista isn't really good for creating something with a UI ( a form with text input boxes and radio buttons)?"</i>
Correct.
Pythonista doesn't offer the ability to create application interfaces with native widgets (radio buttons, drop down fields, etc.) ... currently, anyways.
The only way to do that at the moment is to write a web app in python and host it in Pythonista with the webbrowser class.
-
Well, no, Pythonista does not allow you to create native iOS elements. But it's certainly possible to create standard HTML interfaces for applications. It's not drag-and-drop easy, but it also isn't that difficult to code by hand. Certainly not for anyone that's familiar with HTML. In fact, I have posted a <a href="http://omz-software.com/pythonista/forums/discussion/123/interactive-form-example#Item_1">simple example</a>. No need to dismiss UI development. In fact, it should be encouraged.
It struck me as odd that Pythonista seemed to inhabit the two extremes: either command line or full roll-your-own graphics. Why should web-based interfaces be ignored? They are pretty common nowadays. ;) The browser is fully capable of rendering all the text boxes, selects, checkboxes, radio buttons, etc. you need for useful applications. It may not be as pretty as Cocoa Touch, but it sure beats a command line for interactivity and consistency, or trying to create all the elements from scratch.
-
And Bottle (import bottle, dir(bottle)) makes REST trivial
-
Ok, the import works but there's no documentation. Could you post a link?
-
@uncleWalter - yup, will dig one out but hopefully something more interesting first.
Basically, I don't want to create a web server based app rendered in a separate webbrowser (embedded or standalone). I don't want to have to think about 10 minute time outs or anything similar... I want to write proper GUI apps in Pythonista.
Reading a shedload of links, it's clear that there's some debate about whether or not Pythonista can allow access to native controls (although ScriptKit seems to do it). For something I'm writing now, I only really need some buttons and (if I can) a combobox so I wondered if I could implement a gui using scenes and layers.
The code at https://gist.github.com/LandyQuack/5182877 is at a very early stage but it basically demonstrates creating two buttons (bordered rectangles for now) which respond to touch by playing a sound. It's nothing fancy but, it may be enough for some.
Essentially, I noticed that Layers are moveable rectangular screen areas which can have a border, a Scene is basically the outer window of a gui app, the master Scene knows which layers have been added and they in turn know which layers have been added to them. Touch events know which layer generated them so...
Sounded enough like windows (as a base for controls) to be worth playing with.
So far, I've got a couple of Button controls which automatically add themselves to a parent window (the scene) and touch events caught in the outer Scene (the app) and passing the touch event to the layer which generated it.
Haven't explored events within sub layers yet e.g. a bar of buttons (a layer containing say half a dozen sub layers which behave as button).
Hope this helps someone.
-
Updated code at https://gist.github.com/LandyQuack/5183934 adds a clickable text label. All still a bit rough and ready but a useful enough start.