omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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.


    Just a simple button :(

    Pythonista
    2
    3
    2406
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • NRWTV2
      NRWTV2 last edited by

      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'
      1 Reply Last reply Reply Quote 0
      • omz
        omz last edited by

        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.

        1 Reply Last reply Reply Quote 3
        • NRWTV2
          NRWTV2 last edited by

          @omz thy :3

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          Powered by NodeBB Forums | Contributors