This tool is donation based and free. 🙏 We're looking for donations to keep it running — $360/year covers our server costs.

$18 of $360 · 5%
Donate
This fact check is over 4 months old. The situation may have changed significantly — please recheck before relying on it.

Pythonista 3 Minimal Unrestricted Button Code Works

“import ui def action(sender): print("works") btn = ui.Button(title='Press') btn.action = action v = ui.View() v.add_subview(btn) v.present() This is the minimum unrestricted button for Pythonista 3”
Correct minimal example
Confidence: High Checked on April 13, 2026

Summary

The code creates a UI button, assigns an action, adds it to a view, and presents the view, matching the simple button example shown in Pythonista’s UI documentation. It functions as a minimal, unrestricted button script in Pythonista 3.

Recheck this fact Runs a fresh check with up-to-date sources

Sources 60 searched

david.goodger.org
  • Code Like a Pythonista: Idiomatic Python - David Goodger

    >>> david, (gname, gtitle, gphone) = people >>> gname 'Guido' >>> gtitle 'BDFL' >>> gphone 'unlisted' >>> david ['David', 'Pythonista', '+1-514-555-1234']

omz-software.com
  • Using Pythonista — Python 3.6.1 documentation

    The console can be shown in a compact form directly next to the editor by tapping the “split screen” button. If you’ve used any programming editor before, you’ll probably feel right at home in Pythonista.

  • ui — Native GUI for iOS — Python 3.6.1 documentation

    Let’s start with a simple example. The following code just shows a button that says ‘Tap me!’. When you tap on it, it changes its title to ‘Hello!’.

  • What’s New in Pythonista — Python 3.6.1 documentation

    All code samples now have “Copy” and “Open in Editor” buttons attached to them for quickly trying out things you read about. There is a new “Using Pythonista” page that provides an illustrated overview of the UI. Text in the documentation is now hyphenated for better readability, especially on the iPhone. The canvas documentation contains more details and examples.

stackoverflow.com
  • python - GUI button proformance in pythonista - Stack Overflow

    Since I was testing without making a .pyui file (the file where you edit the actual GUI layout) I had to remove ui.loadview(). But this works and should give you a good starting point. The Pythonista UI Module can be tricky, but sticking with it is worth it :)

pythonista3.rssing.com
  • Automating iOS: How Pythonista Changed My Workflow

    Both views can be sorted by name or modified date; you can add scripts with a + button at the top and delete existing ones by tapping on the Edit button. A downside of Pythonista is that the Script Library doesn’t offer further organizational features to better sort your scripts. You can’t create folders, and it gets pretty confusing in snippet view; for the time being, I’m using list view, but it takes time to find scripts. I would definitely welcome an option to organize scripts by category or purpose. Due to restrictions imposed by Apple, Pythonista can’t have a sync feature to import executable code from external sources like Dropbox.

This fact check is free and donation-based. $1 powers ~30 fact-checks.

Donate $1 to support fact-checking

Check another fact