|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
又遇奇葩状况:- import pygame
- import sys
- pygame.init()
- size = width, height = 600, 400
- screen = pygame.display.set_mode(size)
- pygame.display.set_caption("a")
- bg = (0, 0, 0)
- font = pygame.font.Font(None, 20)
- line_height = font.get_linesize()
- position = 0
- screen.fill(bg)
- while True:
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- sys.exit()
- screen.blit(font.render(str(event), True, (0, 255, 0)), (0, position))
- position += line_height
- if position > height:
- position = 0
- screen.fill(bg)
- pygame.display.flip()
复制代码
这段代码运行之后,会显示以下错误:- Traceback (most recent call last):
- File "D:\python相关\Python学习\程序\pygame\pg2.py", line 11, in <module>
- font = pygame.font.Font(None, 20)
- RuntimeError: Can't seek in stream
复制代码
这到底是什么情况???我都要崩溃了
试试这个:
- font = pygame.font.SysFont("arial", 20)
复制代码
|
|