Hello I'm creating a sudoku game in pygame and while making the board I wanted to make all lines black but some thicker than others like so:
Do any of you know of a way to do this?
Hello I'm creating a sudoku game in pygame and while making the board I wanted to make all lines black but some thicker than others like so:
Do any of you know of a way to do this?
The last argument of pygame.draw.line is optional and specifies the thickness of the line:
draw a straight line
line(surface, color, start_pos, end_pos, width=1) -> Rect...
width (int) -- (optional) used for line thickness
Minimal example:
import pygame
pygame.init()
window = pygame.display.set_mode((400, 400))
clock = pygame.time.Clock()
run = True
while run:
clock.tick(100)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
window.fill((255, 255, 255))
for i in range(10):
w = 3 if i == 3 or i == 6 else 1
pygame.draw.line(window, (0, 0, 0), (50, 50+i*30), (320, 50+i*30), w)
pygame.draw.line(window, (0, 0, 0), (50+i*30, 50), (50+i*30, 320), w)
pygame.display.flip()
pygame.quit()
exit()