반응형 pywin323 Python - pywin32를 이용한 USB device 검색 Code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 import win32com.client def check_fw_update_device(): wmi = win32com.client.GetObject ("winmgmts:") devices = [] for usb in wmi.InstancesOf ("Win32_PnPEntity"): find_device = 'USB Input Device' if find_device in str(usb.Description): print(f"DeviceID: + {str(usb.DeviceID)}") print(f"PNPDevic.. 2022. 12. 29. Python - win32gui를 이용한 color얻은 후 rgb로 변환 Code 1 2 3 4 5 6 7 8 9 10 11 import win32gui def convert_rgb(value): B = value & 255 G = (value >> 8) & 255 R = (value >> 16) & 255 return (R, G, B) pos_color = win32gui.GetPixel(win32gui.GetDC(win32gui.GetActiveWindow()), 200, 200) print(hex(pos_color)) print(convert_rgb(pos_color)) Colored by Color Scripter cs 0x262525 (38, 37, 37) 2022. 12. 29. Python - win32api and win32con을 이용한 정보 얻기 Code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 import win32api import win32con print("------Get System Info-------------------------") print(win32api.GetComputerName()) print(win32api.GetUserName()) print(win32api.GetLocalTime()) print(win32api.GetSystemTime()) print("\n-----Get Display Info-----------------------") print('Width:', win32api.GetSystemMetrics(0)) print('Height.. 2022. 12. 29. 이전 1 다음 반응형