I find myself lost and in need of help. I've looked through various examples of code that teaches one how to take user input, yet I've noticed they all pretty much use the ui designer. True the ui designer is great, I tend to prefer to hard code mainly to get more experience at being able to code in any interpreter such as the original Python interpreter.
So how do I go about gathering and using user input?
In this one I'm trying to go along with an example i found with-in a form which some questioned how to take input using text field.
# coding: utf-8
import ui
w, h = ui.get_screen_size()
# action
def tex_act(sender):
sender.superview["texting"].text
# view
the_view = ui.View()
# text field
texting = ui.TextField()
texting.frame = (0, 0, 320, 80)
texting.placeholder = "Here: "
texting.action = tex_act
# text view
view_text = ui.TextView()
view_text.frame = (0, 90, 320, 300)
view_text.editable = False
# add subview
the_view.add_subview(texting)
the_view.add_subview(view_text)
# present
the_view.present("sheet")
Other example of my failure this more so how I'm trying to write my scripts.
# coding: utf-8
import ui
def text_field_action(sender):
sender.superview = view_text.text
def my_views():
# view
the_view = ui.View()
# text field
texting = ui.TextField()
texting.name = "texting"
texting.frame = (0, 0, 320, 50)
texting.placeholder = "here: "
# text view
view_text = ui.TextView()
view_text.name = "view_text"
view_text.editable = False
view_text.frame = (0, 70, 320, 360)
# text action
texting.action = text_field_action
# add subview
the_view.add_subview(view_text)
the_view.add_subview(texting)
# present
the_view.present("sheet")
# run main
def main():
my_views()
if __name__ == "__main__":
main()
I truly could appreciate any help, guidance, suggestions, and tips regarding Pythonista, python, and how to properly writing my scripts. As I see many of you have far more experience and greater talent at this than myself. Thank you.