Commit 3578d573 authored by nrossol's avatar nrossol
Browse files

Finished grid drawing in gui.py, interactive buttons/grid to be implemented next.

parent 6dfe86fe
......@@ -17,15 +17,17 @@ grid = [ [ 3, 2, 1, 0, 5, 0, 9, 4, 7 ],
BLACK = (0,0,0)
WHITE = (255,255,255)
#Initialize Pygame:
#os.environ["SDL_VIDEODRIVER"] = "dummy"
os.environ['SDL_VIDEODRIVER'] = 'windib'
#Initialize Pygame and variables::
pygame.init()
pygame.display.init()
screen_width = 500
screen_height = 500
screen_width = 490
screen_height = 490
buttonArea = 100 #height of area where buttons will be below the grid
box_size = 50
margin = 5
screen = pygame.display.set_mode([screen_width,screen_height])
pygame.display.set_caption("Main")
font = pygame.font.SysFont("Comic Sans MS",30)
screen = pygame.display.set_mode([screen_width,screen_height+buttonArea])
pygame.display.set_caption("Sudoku")
clock = pygame.time.Clock()
#Main Loop:
......@@ -35,4 +37,26 @@ while not done:
if event.type == pygame.QUIT:
done = True
screen.fill(BLACK)
#draw grid:
for i in range(0,screen_width,box_size+margin):
for j in range(0,screen_height,box_size+margin):
pygame.draw.rect(screen, WHITE, (i,j,box_size,box_size), 0)
pygame.draw.rect(screen, WHITE, (0,495,490,100), 0)
#fill in grid:
for i in range(0,9):
for j in range(0,9):
number_surface = font.render(str(grid[i][j]), False, (0,0,0))
screen.blit(number_surface, (7 + i*(box_size + margin), 7 + j*(box_size + margin)))
#update display
pygame.display.update()
#make screen update 60 fps
clock.tick(60)
pygame.quit()
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment