鱼C论坛

 找回密码
 立即注册
查看: 2243|回复: 1

python pygame出现错误

[复制链接]
发表于 2017-9-4 18:35:15 | 显示全部楼层 |阅读模式

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

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

x
如图
在预加载音乐的时候出错
不能传图片了QAQ
主代码:

  1. import subprocess
  2. import pygame

  3. h = -1

  4. #初始化
  5. pygame.init()

  6. #预加载bgm
  7. pygame.mixer.music.load("bad_apple.ogg")

  8. with open("badapple.txt") as batxt:
  9.     read = batxt.read().split("\n")
  10.    
  11. print("bad apple")
  12. input("回车开始")
  13. #播bgm
  14. pygame.mixer.music.play("bad_apple.ogg")

  15. while h < 229880 :
  16.     subprocess.call("cls",shell = True)
  17.     b = -1
  18.     while b < 34:
  19.         h = h + 1
  20.         b = b + 1
  21.         print(read[h])
  22.         #淡出
  23.         if b >840 :
  24.             pygame.mixer.music.fadeout(10)

  25.         
  26. print("播放完毕")
  27. input("回车结束")
复制代码


错误码:
  1. Traceback (most recent call last):
  2.   File "C:\Users\Administrator.WIN7-1704041035\Desktop\python程序集\bad apple\bad apple2.py", line 19, in <module>
  3.     pygame.mixer.music.play("bad_apple.ogg")
  4. TypeError: an integer is required (got type str)
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2017-9-4 18:35:28 | 显示全部楼层
来人
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-10 06:55

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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