wxPython MediaCtrl Tutorial

This is just a short post to explain something I had a hard time understanding: How to get the media player working for Windows 7, (64bit, if that matters here, I’m not actually sure).

I never fully understood what it took to start playing a song, since I assumed that I needed to just load the song into the media player ctrl, then play it, but there was a subtle thing I needed to do as well, and that was to catch the event EVT_MEDIA_LOADED.

before I could sucessfully play the mp3, as well as change the backend of the mediaCtrl to WMP10, instead of leaving it as default. The part that really through me for a loop was that all the docs I had read on this, just loaded and then played the song right away. Seems like there’s a bug somewhere that doesn’t catch that event on Windows 7.

Anyways, here’s a simple script, after the jump, that lets you play one single song, hardcoded into the file, if you want to change the song to play, you’ll have to change the filepath in the code.

Continue reading “wxPython MediaCtrl Tutorial”