'''
Created on 21. sep. 2013
Page 136 in ze almighty python book, 4.3
@author: Christian
'''
import sys,pygame,time
pygame.init()
numLevels = 15 # Number of levels
unitSize = 25 # Height of one level
white = (255,255,255) # RGB Value of White
black = (0,0,0) # RGB Value of Black
size = unitSize * (numLevels + 1)
xPos = size /2.0 # Constant position of X value
screenSize = size,size # Screen size to accomodate pygame
screen = pygame.display.set_mode(screenSize)
for level in range(numLevels):
yPos = (level + 1) * unitSize
width = (level +1) * unitSize
block = pygame.draw.rect(screen,white,(0,0,width,unitSize),0)
block.move(xPos,yPos)
pygame.time.wait(100)
pygame.display.flip()
block.move(xPos,yPos) 应该可以工作,但由于某些奇怪的原因它不能工作。我不知道为什么。我相当确定其他一切工作正常,我已经在互联网上搜索了几个小时,然后才来到这个网站寻求帮助。