Python获取系统音量

1,如果是windows下

试试这个python 模块winsound
http://docs.python.org/2/library/winsound.html
这个也可以
winmm调整windows系统的音量大小

http://www.oschina.net/code/snippet_72895_5978



2,#coding=utf-8
from ctypes import windll
WM_APPCOMMAND = 0x319
APPCOMMAND_VOLUME_UP = 0x0a
APPCOMMAND_VOLUME_DOWN = 0x09
APPCOMMAND_VOLUME_MUTE = 0x08
hwnd=windll.user32.GetForegroundWindow()
windll.user32.PostMessageA(hwnd,WM_APPCOMMAND,0,APPCOMMAND_VOLUME_MUTE*0x10000)


3,win32gui

使用pip install win32gui  安装



你可能感兴趣的:(Python)