parent
54c586c7f6
commit
e6bc34ffa7
@ -1,26 +0,0 @@
|
||||
import pygame
|
||||
# 初始化pygame
|
||||
pygame.init()
|
||||
screen = pygame.display.set_mode((600, 600)) # 设置窗口长宽
|
||||
pygame.display.set_caption('五子棋-EduCoder') # 设置 pygame 窗口名
|
||||
while True: # 死循环确保窗口一直显示
|
||||
for event in pygame.event.get(): # 遍历所有事件
|
||||
if event.type == pygame.QUIT: # 如果单击关闭窗口,则退出
|
||||
pygame.quit() #关闭 pygame 程序
|
||||
exit() #结束程序
|
||||
screen.fill((204, 153, 102)) # 将界面设置棕色
|
||||
pygame.display.update() # 必须调用update才能看到绘图显示
|
||||
space = 20 # 四周留下的边距
|
||||
cell_size = 40 # 每个格子大小
|
||||
cell_num = 15 #设置线条数
|
||||
#pygame.draw.line(窗口, 线条颜色, 开始坐标, 结束坐标, 线条大小 )
|
||||
for x in range(0, cell_size * cell_num, cell_size):
|
||||
pygame.draw.line(screen, (200, 200, 200), (x + space, 0 + space),
|
||||
(x + space, cell_size * (cell_num - 1) + space), 1)
|
||||
#绘制五个点
|
||||
#pygame.draw.circle(窗口,颜色,坐标,圆半径,线条大小)
|
||||
pygame.draw.circle(screen, (0, 0, 0), (cell_size * 4 + space, cell_size * 4 + space), 2, 1)
|
||||
pygame.draw.circle(screen, (0, 0, 0), (cell_size * 10 + space, cell_size * 10 + space), 2, 1)
|
||||
pygame.draw.circle(screen, (0, 0, 0), (cell_size * 10 + space, cell_size * 4 + space), 2, 1)
|
||||
pygame.draw.circle(screen, (0, 0, 0), (cell_size * 4 + space, cell_size * 10 + space), 2, 1)
|
||||
pygame.draw.circle(screen, (0, 0, 0), (cell_size * 7 + space, cell_size * 7 + space), 2, 1)
|
Loading…
Reference in new issue