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.


    Error message?

    Pythonista
    2
    2
    1756
    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.
    • dat2357
      dat2357 last edited by omz

      The script below is for a Simple calculator ui. When the add button is clicked, the numbers are supposed to be read from two text fields, txtX and txtY. and stored in variables x & y. (This part works.) However, I keep getting the message "unicode object is not callable" , when line 4 is implemented. Here is the code: Can someone please help?

      import ui
      
      def add(sender):
           x = float(sender.superview['txtX'].text)             #1
           y = float(sender.superview['txtY'].text)             #2
           sum = x + y                                                            #3
           sender.superview['txtOutput'].text(str(sum))   #4
      
      ui.load_view('SimpleCalGui').present('sheet')
      
      1 Reply Last reply Reply Quote 0
      • chriswilson
        chriswilson last edited by

        Hi @dat2357
        Try making line 4 this:

        sender.superview['txtOutput'].text = (str(sum)) #4

        The equals sign is all-important. Hope this helps!

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