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.
How To make a "live" textbox?
-
How would I use the ui module (preferably using the built in visual ui editor) to create a ui that has a constantly updating text box? I want to be able to constantly feed my user information as they progress through my text-based-game. (This means I don't want the user to be able to edit the text I show them.)
-
I can't help with the auto updating text box, but If you don't want the user to be able to edit the text you show them, text view would be the thing to use. You can set it up to look just like a text field if you're going for that.
-
If you want a scrollable view, similar to the console, then TextView is the way to go. You can set
tv.editable = False
To disable editing.
To append text, you would simply add to the text property:
tv.text += 'You were eaten by a Grue.\n'
In the above, tv is the actual textview object, which you can get by name from your loaded root view.
You might consider implementing a delegate for the textview, which implements
def textfield_did_change(self, textfield): textfield.content_offset = (0, textfield.content_size[1] - textfield.height)
Which forces scrolling to the bottom after each line is added
-
You guys are the best! That's exactly what I was looking for, thanks for the help.