Skip to content

Instantly share code, notes, and snippets.

@jamesgecko
Created September 5, 2012 00:04
Show Gist options
  • Select an option

  • Save jamesgecko/3628306 to your computer and use it in GitHub Desktop.

Select an option

Save jamesgecko/3628306 to your computer and use it in GitHub Desktop.
Drawing stuff
#!/usr/bin/env python
import os, sys, random, time, math
import pygame
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((510, 510))
pygame.display.set_caption('Drawing')
background = pygame.Surface(screen.get_size())
background = background.convert()
background.fill((0, 0, 0))
def draw(points, lines):
points = points[:]
lines = lines[:]
for point in points:
pygame.draw.circle(screen, [255, 126, 0], [point[0], point[1]], 4, 0)
pygame.draw.aalines(screen, [255,255,0], True, lines, 2)
pygame.display.update()
while pygame.event.poll().type != KEYDOWN: pygame.time.delay(10)
def main():
points = [[0,0], [100,100], [200,200]]
lines = [[0,0], [100,100], [200,200]]
draw(points, lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment