User Profile

Collapse

Profile Sidebar

Collapse
Mahem Ones
Mahem Ones
Last Activity: Aug 16 '11, 10:21 AM
Joined: Jun 5 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Mahem Ones
    started a topic Global Variables Over Multiple Source Files

    Global Variables Over Multiple Source Files

    So basically I can't seem to get global variables in functions I import from a different file.

    Also are the only scopes in python classes and functions?
    Or is there a way to set your own scopes.
    Like in C++ you can put {} brackets anywhere you like.
    See more | Go to post

  • Pygame TypeError: python.surface object unsubscriptable

    I am trying to run some pygame code and get this error:
    Pygame TypeError: python.surface object unsubscriptable
    Here is the code:
    Code:
    ball1 = [ 100 ,50 , 1, 0]
    
    def ball (x,y,movex,movey):
        if x < 0 :
            x * -1
        if x > 580:
            x= x* -1
        if y < 0:
            y = y* -1
        if y > 260:
            y = y*-1
    
        x+= movex
    ...
    See more | Go to post

  • Mahem Ones
    replied to Python 'NoneType' Error
    That works great!!
    The error:
    'TypeError: 'NoneType' object is not subscriptable' /iterable
    Was because I used 'return pieces' instead of 'return (pieces)'

    -Thanks
    mahem1
    See more | Go to post

    Leave a comment:


  • Mahem Ones
    started a topic Python 'NoneType' Error

    Python 'NoneType' Error

    I want to print out list pieces without any zeros to make it more readable.
    Part of this code is in a while loop.
    Code:
    import copy
    pieces = [ [1,2,3,4,5,6] , [0,0,0,0,0,0], [0,0,0,0,0,0] ]
    def formatt (formatt) :
            while 0 in formatt[1] :
                    formatt[1].remove(0)
            while 0 in formatt[2] :
                    formatt[2].remove(0)
            while 0 in formatt[0] :
    ...
    See more | Go to post
No activity results to display
Show More
Working...