import pygame
pygame.init()
white = (255, 255, 255)
black = (0, 0, 0)
address = 'C:/Python/Pygame/20240202/haha/'
image_p = address + "CAT.png"
width, height = 1024, 1024
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption("Chessboard")
clock = pygame.time.Clock()
ic,jc=8,8
size=width//jc
image = pygame.image.load(image_p)
def draw():
for i in range(ic):
for j in range(jc):
x = j * size
y = i * size
if (i + j) % 2 == 0:
color = white
else:
color = black
pygame.draw.rect(screen, color, (x, y,size, size))
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
draw()
pygame.display.flip()
clock.tick(60)
pygame.quit()top of page

실제 작동 상태를 확인하려면 라이브 사이트로 이동하세요.
20250826
20250826
댓글 0개
좋아요
댓글(0)
더 이상 게시물에 대한 댓글 기능이 지원되지 않습니다. 자세한 사항은 사이트 소유자에게 문의하세요.
bottom of page


