Hardware Reference
In-Depth Information
def setupScreen() : # initialise the screen
screen.blit(background,[0,0]) # set background colour
drawControl(10,58,”Clear”)
drawControl(86,62,”Invert”)
drawControl(168,68,”Faster”)
drawControl(250,74,”Slower”)
drawControl(350,132,”Auto Step”)
for x in range(0,32) :
drawCol(x,seq[x])
pygame.display.update()
def drawControl(xPos,xLen,name) :
pygame.draw.rect(screen,cTextBack,
(xPos, 216, xLen,32), 0)
pygame.draw.rect(screen,cOutline,
(xPos, 216, xLen,32), 2)
text = font.render(name, True, cText, cTextBack )
textRect = text.get_rect()
textRect.topleft = xPos+4, 220
screen.blit(text, textRect)
def drawCol(x,value):
boxNum = 0
x = 10 + x*24
y = 10
for bit in range(0,8):
# first draw the box -
# fill colour depends on sequence bit state
if ((value >> boxNum) & 1) != 1 :
pygame.draw.rect(screen,cLEDoff,
(x, y + 24*boxNum, 20,20), 0)
else :
pygame.draw.rect(screen,cLEDon,
(x, y + 24*boxNum, 20,20), 0)
#now draw the outline of the box
pygame.draw.rect(screen,cOutline,
(x, y + 24*boxNum, 20,20), 2)
boxNum +=1
def mouseGet() : # see where we have
# clicked and take the appropriate action
Search WWH ::




Custom Search