pyto_core

Extend the editor

Warning

This library requires iOS / iPadOS 13.

Run a script at the app’s startup and extend the code editor.

Getting Started

To run a script at startup, run the startup_script() function from the script you want to execute at startup. Only one startup script at time is supported because only one script can be receive editor’s events. But nothing stops you from importing other scripts.

You can then run a while loop in background for example. Or you can also add a button to the code editor’s toolbar. See the EditorDelegate class for more information.

API Reference

pyto_core.startup_script()

Sets the current running script as startup script, so each time Pyto will be launched, this script will be executed in background. This function cannot be executed on a subthread.

Setting the startup script will replace the old one. Only one plugin is supported at time because only one object can be receive editor’s events. But nothing stops you from importing other modules.

pyto_core.show_view(view: pyto_ui.View, mode: ui_constants.PRESENTATION_MODE)

Shows a PytoUI View.

Use this function to show a view on a plugin running in background. That will show the view on any screen of the app on the key window. Also, this function returns before the view is closed, so that’s also useful for running code after showing the view.

Parameters:
  • view – The View object to present.
  • mode – The presentation mode to use. The value will be ignored on a widget. See Presentation Mode constants for possible values.