6
Is there any way to run an audio file with Pyqt?
You can do this only with Pyqt or you need to install another library?
6
Is there any way to run an audio file with Pyqt?
You can do this only with Pyqt or you need to install another library?
6
If you want to use Pyqt’s native method, you have QSound
:
meusom = QSound("alerta.wav")
meusom.play()
There is a method that returns a value bool, for you to know if the feature is available:
bool QSound::isAvailable()
This is useful for you to check if you need an alternative means of notification if the platform is unable to play audio.
The question speaks in Pyqt 4, but for those using the 5, it makes up for a look at QSoundEffect
also, more versatile and low latency:
4
Apparently, QMedia
is only available on Pyqt5 (since QMedia
requires Qt5), but Python itself can do a few things without Pyqt.
There is the lib playsound, which has no dependencies, can be installed via pip
:
$ pip install playsound
And call her that:
from playsound import playsound
playsound('/home/pasta/play.mp3')
Browser other questions tagged python python-2.7 pyqt pyqt-4 pyqt-5
You are not signed in. Login or sign up in order to post.