예제 #1
0
def main():
    pic = Picture((800,800))
    pic.setPenColor(128,80,255)
    pic.drawRectFill(0,0,800,800)
    for i in range(0, NUM_BUILDINGS):
        drawBuilding(pic)
    for i in range(0, 24):
        drawSun(pic, i)
    pic.writeFile("guss.bmp")
    input()
예제 #2
0
def main():
    # Create the canvas and fill in the background
    canvas = Picture((WIDTH, HEIGHT))
    chooseColor(canvas)
    canvas.drawRectFill(0, 0, WIDTH, HEIGHT)
    # Create 13 objects on the canvas
    for i in range(0, 13):
        chooseColor(canvas)
        chooseShape(canvas)
        
    canvas.display()
    canvas.writeFile("mlewisno.bmp")
예제 #3
0
def main() :
    W = 800
    H = 600
    art = Picture((W,H))
    art.setPenColor(20,0,20) #1
    art.drawRectFill(0,0,W,H) #2
    art = drawStars(art,W,H)
    art = drawMoon(art,60,60)
    art = drawLandscape(art)
    art = drawWolf(art,394,350)
    art.drawString(720,580,"-Tyler") #8
    art = pythonWT(art)
    art.writeFile("Wolf.bmp")
    art.display()
예제 #4
0
def main():
    canvas = Picture((400, 400))
    sky(canvas)
    ground(canvas)
    pipe(canvas)
    blocks(canvas)
    questionMarks(canvas)
    mario(canvas)
    sun(canvas)
    clouds(canvas)
    horizontalLines(canvas)
    verticalLines(canvas)
    canvas.display()
    canvas.writeFile("cdavies.jpg")
    input("Press enter to end the prgram.")
예제 #5
0
def main():
    # Get the width for the canvas
    width = int(eval(input("How wide do you want the canvas to be? (In pixels) ")))
    height = width
    # Get the number of bricks tall the user wants the pyramid to be
    try:
        numBricks = int(eval(input("How many bricks tall do you want your pyramid to be? ")))
    except:
        print("That was a non-numeric value. You are the worst ever. Exciting.")
    # Create the canvas
    canvas = Picture((width, width))
    # Fill in the background
    canvas.setPenColor(255, 255, 255)
    canvas.drawRectFill(0, 0, width, width)
    # Calculate brick height and width
    try:
        brickHeight = int(width/numBricks)
        brickWidth = int(width/numBricks)
    except:
        print("You put in 0 bricks, so you will only get a background. AHAHAHAHAHAAHAHAHAHAHAHAHA. AHAHA. AHA. HA.")
    # Loop through each row of the pyramid
    
    rowX = 0
    rowY = 0
    
    for i in range(0, numBricks):
        # Find the y coordinate for every brick in this row
        brickY = brickHeight*(i + 1)
        # Loop through each brick in each row
        for j in range(0, numBricks - i):
            # Find the x coordinate for each brick as you go along
            canvas.setPenColor(0, 255, 255)
            canvas.drawRectFill(rowX + j*brickWidth, height - brickHeight - rowY, brickWidth, brickHeight)
            canvas.setPenColor(0, 0, 0)
            canvas.drawRect(rowX + j*brickWidth, height - brickHeight - rowY, brickWidth, brickHeight)
            
        rowX += int(brickWidth/2)
        rowY += brickHeight
    canvas.writeFile("pyramid.bmp")
    canvas.display()