[英]pywin32: GetSystemPaletteEntries
pywin32是否有等效的GetSystemPaletteEntries
? 如果没有,我怎么打这个电话?
这有效,返回一个与PIL兼容的调色板:
import ctypes, win32gui
def getPalette(hwnd):
#hwnd = win32gui.GetDesktopWindow() #if you want desktop window palette?
hwndDC = win32gui.GetWindowDC(hwnd)
buff = ctypes.c_buffer("0"*(256*4)) #R, G, B, and flags
ctypes.windll.gdi32.GetSystemPaletteEntries(hwndDC, 0, 256, buff)
win32gui.ReleaseDC(hwnd, hwndDC)
#ignore every 4th entry which is the flags
res = [ord(x) for i,x in enumerate(buff) if i%4 != 3]
return res
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.