Beginner's ui questions
densi last edited by
Hi everyone, I have a couple of basic question regarding working with ui module.
I'm trying to make a simple app that has 3 pages. So when you done editing some textfields on one page you click ok button and it takes you to the second page.
Right now I have two pyui files and I make transition between pages like so:
def button_tapped(sender): if sender.name == 'button1': ui.load_view('page1').present('sheet') if sender.name == 'button2': ui.load_view('page2').present('sheet')
Is this the right way to do so?
I want to interact with textfield but it has no action attribute in ui editor, I can't wrap my head around delegates. Can someone please provide me a short example of constructing one. I mean how can I tell my py script to 'listen' to what is happening with my textfield?
Any help will be appreciated!
ccc last edited by ccc
You might want to take a look at ui.NavigationView for paging from one view to the next. For text field delegates, look at AreYouEnabled and other scripts in the ui tutorial https://github.com/Pythonista-Tools/Pythonista-Tools/blob/master/UI.md
If that is not working for you the post a minimum viable script and we can debug it together.
JonB last edited by
I don't love NavigationViews (too clunky, and you don't get the control you often want), but I would advise against trying to present three views.
Instead, your root view would be the one that is presented, and you would add or remove subviews the three subviews as full size in the rootview. Or, add them all, and use visible attribute to hide or unhide them.
TextField does have an action attribute, though TextView does not...