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

    Join Date
    Aug 2004
    Posts
    3
    Rep Power
    0

    pygame.mouse.get_pos()


    I need help! I tryingto write a program that prints the current mouse location to the screen but everytime I try and print it to the screen I get an error saying that I can only print strings or unicode, or that the mouse position is a tuplet and that a tuplet cant be printed/rendered. I tried breaking it apart with [0:1] but that didn't help. Any suggestions?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Posts
    624
    Rep Power
    35
    That also returns a tuple:

    Code:
    >>> point = (118,118)
    >>> point[0:1]
    (118,)
    >>> type(_)
    <type 'tuple'>
    Try something like:

    Code:
    print str(point)
    
    or 
    
    print "%d, %d" % point 
    
    or
    x, y = point
    print str(x) + ", " + str(y)

IMN logo majestic logo threadwatch logo seochat tools logo