鱼C论坛

 找回密码
 立即注册
查看: 5953|回复: 2

[已解决]什么情况???RuntimeError: Can't seek in stream

[复制链接]
发表于 2017-8-16 00:11:43 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
又遇奇葩状况:
  1. import pygame
  2. import sys

  3. pygame.init()

  4. size = width, height = 600, 400
  5. screen = pygame.display.set_mode(size)
  6. pygame.display.set_caption("a")
  7. bg = (0, 0, 0)

  8. font = pygame.font.Font(None, 20)
  9. line_height = font.get_linesize()
  10. position = 0

  11. screen.fill(bg)

  12. while True:
  13.     for event in pygame.event.get():
  14.         if event.type == pygame.QUIT:
  15.             sys.exit()

  16.         screen.blit(font.render(str(event), True, (0, 255, 0)), (0, position))
  17.         position += line_height

  18.         if position > height:
  19.             position = 0
  20.             screen.fill(bg)

  21.     pygame.display.flip()
复制代码

这段代码运行之后,会显示以下错误:
  1. Traceback (most recent call last):
  2.   File "D:\python相关\Python学习\程序\pygame\pg2.py", line 11, in <module>
  3.     font = pygame.font.Font(None, 20)
  4. RuntimeError: Can't seek in stream
复制代码

这到底是什么情况???我都要崩溃了
最佳答案
2017-8-16 02:02:09
试试这个:

  1. font = pygame.font.SysFont("arial", 20)
复制代码

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2017-8-16 02:02:09 | 显示全部楼层    本楼为最佳答案   
试试这个:

  1. font = pygame.font.SysFont("arial", 20)
复制代码

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-8-16 02:22:21 | 显示全部楼层

哇!果然可以了!!!
小甲鱼老师辛苦了,这么晚了都不睡觉。万分感谢!!!
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-25 12:15

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表