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.
Relationship between the .py and the .pyui files?
-
Hi,
Just getting started with using the Pythonista UI builder.
If I select 'Script with UI' and I call my file 'Test UI', then I get an empty Test UI.pyui file and a Test UI.py file with just an 'import ui' in it. Touching the button on the screen flip-flops between the 2 files.
Am I correct in thinking that my actual code goes in a separate source file (e.g. Test Code.py) in which I reference 'Test UI', or should my code go in the 'Test UI.py' file?
Thanks in advance for advice.
-
Your code should typically be in the
Test UI.py
file. Assuming you createdTest UI.py
andTest UI.pyui
, a minimal example forTest UI.py
would be:import ui v = ui.load_view() v.present('sheet')
-
Wow, I can help out with something, I think.
If you have a file 'x.py' and a file 'x.pyui' pythonista basically gives you a nice way to switch between the code view and the user interface. The files are only connected via the interface. No implicit connection is made.# this file called x.py import ui if __name__ == '__main__': # this will work given you have a # file named x.pyui in the same dir v = ui.load_view() v.present() # but you can easily load another view by specifying the file. The .pyui not required. v = ui.load_view(another_view.pyui) v.present()
-
Sorry, indentation off... I am still new.
# this file called x.py import ui if __name__ == '__main__': # this will work given you have a # file named x.pyui in the same dir v = ui.load_view() v.present() # but you can easily load another view by specifying the file. The .pyui not required. v = ui.load_view(another_view.pyui) v.present()