##PYTHON 3.10.8
我想要用pygame写个字,今天发现写不出来,有人知道吗
问题在第一个循环里,我运行无法看到字..
import pygame as pg
from pygame.locals import *
import sys
import server.getInfo as gi
# 初始化设置
pg.init()
screen = pg.display.set_mode((600, 800)) # 窗口句柄
pg.display.set_caption("APP")
colors = {"white":(255,255,255), "black":(0,0,0)}
done = False
colorH,cadd, xadd = 170, 0.0625, 0.125
X = 201
cfont = pg.font.SysFont("microsoftjhenghei", True, 30)
efont = pg.font.SysFont("consolas", True, 30)
while not done:
for event in pg.event.get():
if event.type == QUIT: # 退出事件
sys.exit()
screen.fill(colors["white"])
pg.draw.circle(screen, (colorH, colorH, 255), (X, 250), 10.0)
screen.blit(cfont.render("请稍等.........", True, colors["black"]), (300, 290))
if colorH == 70 or colorH == 170:
cadd = -cadd
if X == 400 or X == 200:
xadd = -xadd
colorH += cadd
X += xadd
pg.display.update()
# 主循环
while True:
for event in pg.event.get():
if event.type == QUIT: # 退出事件
sys.exit()
# 初始化
screen.fill(colors["white"])
# 绘制背景
pg.draw.rect(screen, (220, 220, 220), (0, 750, 600, 50), 0)
# gi.search()
pg.display.update()