是否有GetSystemPaletteEntries
pywin32 的等价物?如果没有,我该如何打这个电话?
问问题
161 次
1 回答
1
这有效,返回一个 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
于 2011-01-05T16:26:15.120 回答