I have a game which, last time I checked, worked fine. The problem I have just today, for some reason I haven't figured out yet, kivy won't play mp3 files, but it will still play wavs. To reiterate, this was never a problem before now, the game ran on both my ubuntu linux os and android without a hitch EDIT: in fact, it still runs fine on my Android. I now get the following error on starting up the game on ubuntu:
File "/home/yerman/python/bird/gamescreens.py", line 107, in update
point_play = self.point.play
AttributeError: 'NoneType' object has no attribute 'play'
I also don't know why there is such a space between point_play and the = in the traceback as it's not like that in the file. I am quite sure that I haven't changed anything since my last time playing the game. There is nothing wrong with the mp3 file itself either. Converting the file to wav and using that instead works fine.
I then wrote this small script and ran it with the same results:
main.py:
import kivy
kivy.require('1.8.0')
import sys
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.core.audio import SoundLoader
class PressMe(BoxLayout):
sound = SoundLoader.load('point.mp3')
def mycallback(self):
self.sound.play()
class myApp(App):
def build(self):
return PressMe()
if __name__ == '__main__':
myApp().run()
kv file:
#: kivy 1.8.0
<PressMe>:
Button:
text: 'press me'
on_press: root.mycallback()
I really don't know why this isn't working, can anyone shed light on this?
Aucun commentaire:
Enregistrer un commentaire