Windows 7+ taskbar thumb buttons for multimedia apps.
- Install the right compiler for your Python version. For example:
- For Python 2.7, install Microsoft Visual C++ Compiler for Python 2.7.
- For Python 3.5, install Visual Studio Community 2015.
- Install Cython (
pip install Cythonworks). setup.py build_ext
You'll get a .pyd file somewhere in the build directory.
winmmtaskbar depends on GTK+ 3 to create the button icons, but it's pretty easy to modify the code to use other ways of creating these icons. Patches to make this more general are welcome.
Assume you have a PLAYER variable containing a media player with a few
media-playery methods, a GObject-like signal system, and a hwnd attribute
storing the main window handle.
import winmmtaskbar
def on_taskbar_button_clicked(button, player):
if button == 0:
player.prev()
elif button == 1:
player.playpause()
else:
player.next()
winmmtaskbar.create_buttons(PLAYER.hwnd,
u"Previous", u"Play", u"Pause", u"Next",
on_taskbar_button_clicked, PLAYER)
PLAYER.connect('state-change', lambda is_playing:
winmmtaskbar.set_playing(PLAYER.hwnd, is_playing))
The Windows API (ITaskbarList3) does not allow adding or removing taskbar buttons once they are set.
