import pygame
import sys
# 初始化Pygame
pygame.init()
# 设置窗口尺寸
d = 1000
width, height = 1000+5, 1000+5
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption("Solid Circle with Square")
# 设置颜色
black = (0, 0, 0) # 蓝色
white = (255, 255, 255) # 红色
# 主循环
running = True
import time
st = time.time()
while running:
if time.time()-st>3:
running = False
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# 清除屏幕
screen.fill((255, 255, 255))
# 画一个实心的圆环
pygame.draw.circle(screen, black, (width // 2, height // 2), d/2)
pygame.draw.circle(screen, white, (width // 2, height // 2), d*0.85/2)
# 画一个实心的圆环
# 在圆环内画一个实心的正方形
square_size = 50
k = d*0.72/2
square_rect = pygame.Rect((width // 2 - k, height // 2 - k/10, 2*k, k/5))
pygame.draw.rect(screen, black, square_rect)
square_rect = pygame.Rect((width // 2 - k/10, height // 2 - k, k/5,2*k))
pygame.draw.rect(screen, black, square_rect)
pygame.image.save(screen,'circlex.png')
# pygame.quit()
# 刷新屏幕
pygame.display.flip()
# 退出Pygame
pygame.quit()
sys.exit()
import pygame
import sys
# 初始化Pygame
pygame.init()
# 设置窗口尺寸
d = 1000
width, height = 1000+5, 1000+5
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption("Solid Circle with Square")
# 设置颜色
black = (0, 0, 0) # 蓝色
white = (255, 255, 255) # 红色
# 主循环
running = True
import time
st = time.time()
while running:
if time.time()-st>3:
running = False
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# 清除屏幕
screen.fill((255, 255, 255))
# 画一个实心的圆环
pygame.draw.circle(screen, black, (width // 2, height // 2), d/2)
pygame.draw.circle(screen, white, (width // 2, height // 2), d*0.85/2)
# 画一个实心的圆环
# 在圆环内画一个实心的正方形
square_size = 50
k = d*0.72/2
square_rect = pygame.Rect((width // 2 - k, height // 2 - k/10, 2*k, k/5))
pygame.draw.rect(screen, black, square_rect)
square_rect = pygame.Rect((width // 2 - k/10, height // 2 - k, k/5,2*k))
pygame.draw.rect(screen, black, square_rect)
pygame.image.save(screen,'circlex.png')
# pygame.quit()
# 刷新屏幕
pygame.display.flip()
# 退出Pygame
pygame.quit()
sys.exit()