#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    2
    Rep Power
    0

    TypeError: 'dict' object is not callable


    Hello,

    I tried to run a program (moving a circle by arrow keys) on codescupltor but I get this error TypeError: 'dict' object is not callable.

    What's wrong in it? I am a beginner so please help me to understand clearly. Thank you.


    I get error second line of below code.

    def key_down(key):
    if key == simplegui.KEY_MAP('left'):
    position[0]-=2
    elif key == simplegui.KEY_MAP("right"):
    position[0]+=2
    elif key == simplegui.KEY_MAP("up"):
    position[-1]+=2
    elif key == simplegui.KEY_MAP("down"):
    position[-1]-=2
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2007
    Location
    Joensuu, Finland
    Posts
    439
    Rep Power
    67
    Originally Posted by alapatik
    TypeError: 'dict' object is not callable.
    You need to use brackets instead of parentheses: () is calling, [] is indexing.
    My armada: openSUSE 13.2 (home desktop, work desktop), openSUSE 13.1 (home laptop), Debian GNU/Linux 7.7.0 (mini laptop), Ubuntu 14.04 LTS (server), Android 4.2.1 (tablet), Windows 7 Ultimate (testbed)
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    2
    Rep Power
    0
    Originally Posted by SuperOscar
    You need to use brackets instead of parentheses: () is calling, [] is indexing.
    Thank you. Solved.

IMN logo majestic logo threadwatch logo seochat tools logo