%matplotlib notebook

import pew # setting up tools for the pewpew

pew.init() # initialize the game engine...
screen = pew.Pix() # ...and the screen

screen.pixel(1,2,3) # put a bright pixel at (1,2)
pew.show(screen) # update screen to display the above change

pew.tick(5) # pause for 5 seconds before quitting

import pew # setting up tools for the pewpew

pew.init() # initialize the game engine...
screen = pew.Pix() # ...and the screen

# loop over the square centered on (1,2) and make all dim
(X,Y) = (1,2)
for dX in [+1,0,-1]:
    for dY in [+1,0,-1]:
        screen.pixel(X+dX,Y+dY,2)

pew.show(screen) # update screen to display the above changes

pew.tick(5) # pause for 5 seconds before quitting

import pew # setting up tools for the pewpew

pew.init() # initialize the game engine...
screen = pew.Pix() # ...and the screen

# loop over the square centered on (1,2) and make all dim
(X,Y) = (1,2)
for dX in [+1,0,-1]:
    for dY in [+1,0,-1]:
        screen.pixel(X+dX,Y+dY,2)
        
screen.pixel(X,Y,0) # turn off pixel at (1,2)     

pew.show(screen) # update screen to display the above changes

pew.tick(5) # pause for 5 seconds before quitting

import pew # setting up tools for the pewpew

pew.init() # initialize the game engine...
screen = pew.Pix() # ...and the screen

# loop over the square centered on (1,2) and make all dim
(X,Y) = (1,2)
for dX in [+1,0,-1]:
    for dY in [+1,0,-1]:
        screen.pixel(X+dX,Y+dY,2)
        
screen.pixel(X,Y,0) # turn off pixel at (1,2) 

while True: # loop which checks for user input and responds

    keys = pew.keys() # get current key presses
    if keys!=0:
        if keys&pew.K_UP: # if UP is pressed, turn the pixel at (1,2) on (to a brightness of 3)
            screen.pixel(X,Y,3)

    pew.show(screen) # update screen to display the above changes

    pew.tick(1/6) # pause for a sixth of a second

