Forum Archive

Just a simple button :(

NRWTV2

Please help, i am trying to make a SIMPLE Button and i am really new to python and pythonista.

I already made a simple pyui File with JUST a simple Button in the center (no name, i just added "button_tapped" as action). But consoles only message is: "Cannot bind action: 'button_tapped is not definied'
```

coding: utf-8

import ui
import console

v = ui.load_view()
v.present('sheet')

As a function:

def button_tapped(sender):
print 'button tapped'

omz

You're almost there. Just move the button_tapped function above the load_view call.

In your script, button_tapped is not yet defined when load_view is called, so the action can't be bound.

NRWTV2

@omz thy :3