Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Python objects

Name: Anonymous 2010-10-30 18:53

Why is oStarSpeck[i] not a point object and instead is
<class 'NoneType'>
<class 'NoneType'>
<class 'NoneType'>
<class 'NoneType'>

info about graphics.py
http://mcsp.wartburg.edu/zelle/python/graphics/graphics/index.html

from graphics import *
import random

WINDOW_SIZE = 300
NUMBER_OF_STARS = 100
oStarSpeck = [Point(0, 0) for _ in range(NUMBER_OF_STARS)]
def main():

    formMain = GraphWin("stars", WINDOW_SIZE, WINDOW_SIZE)
    for i in range(NUMBER_OF_STARS):
        oStarSpeck[i] = Point(random.randint(1, WINDOW_SIZE), random.randint(1,WINDOW_SIZE)).draw(formMain)
        print(type(oStarSpeck[i]))
    iStarCount = NUMBER_OF_STARS
    while (iStarCount > 5):
        print(type(oStarSpeck[random.randint(0, NUMBER_OF_STARS)]))
       
       
           
              
    formMain.getMouse()
   
main()

Name: Anonymous 2010-10-30 19:39

>>5
I don't know, you tried to optimise something you didn't quite know about instead of doing what I'd have done as a beginner. I thought Python was meant for this type of program anyway. You could probably also do
(oStarSpeck[i] = Point(random.randint(1, WINDOW_SIZE), random.randint(1,WINDOW_SIZE))).draw(formMain) if that was your intention.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List