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.
Basic UI Question
-
So first of all I'd like to say hi to the community here because I'm pretty new. I understand the language enough to work with but I don't understand how to work with the GUI as I haven't seen any good documentation explaining how to program with the GUI.
I wanted to make a simple program where I can input text in a text field and then when I click enter, what I typed appears in a label above. Every time I enter a new text and click enter, I want it to add on this text to the old one in the label above, but in a way so that every new text is on a new line. Can anybody please help me with this. Thanks in advance for your time and I'm really enjoying the app!
-
I have several projects using the UI module that may help:
-
ui-tutorial is maybe also a good start...
import ui def button_tapped(sender): view['labelname'].text += 'hello\n' view = ui.View() view.background_color = 'white' label = ui.Label() label.name = 'labelname' label.frame = (50,50,200,200) label.border_color = 'lightgrey' label.border_width = 1 label.number_of_lines = 0 #most important line!!! label.corner_radius = 5 label.text = '' view.add_subview(label) button = ui.Button(title='Add hello!') button.frame = (50,251,200,100) button.border_color = 'blue' button.border_width = 1 button.corner_radius = 5 button.action = button_tapped view.add_subview(button) view.present('fullscreen')
-
Wow @TutorialDoctor. Just down loaded and ran the Web Browser tutorial. Very Nice.
-
@NickAtNight, that tutorial isn't mine but it is nice. Hehe. Someone named humberry.
-
import ui w, h = ui.get_screen_size() def textfield_action(sender): sender.superview['textview'].text += sender.text.strip() + '\n' sender.text = '' view = ui.View(name='Type text in the textfield and hit return...') view.add_subview(ui.TextView(frame=(0, 50, w, h-50), name='textview')) view['textview'].editable = False view.add_subview(ui.TextField(frame=(0, 0, w, 50), name='textfield')) view['textfield'].action = textfield_action view.present()
-
Thanks for all the response everyone!