锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

实时取色器(RGB)

时间:2023-06-23 19:07:00 2x100k14继电器tk261型铠装液位变送器rgb灯带灯条单边出线连接器rgb灯条单边出线连接器

鼠标的位置可以实时显示RBG(带弹窗),实时取色方便,创作创作。如果你喜欢,请喜欢收藏。~

# -*- coding: utf-8 -*- import pyautogui, sys from ctypes import *  # 在屏幕上获取坐标的颜色  def GetColor():     r = 0     g = 0     b = 0     try:         x, y = pyautogui.position()         gdi32 = windll.gdi32         user32 = windll.user32         hdc = user32.GetDC(None)  # 获取颜色值         pixel = gdi32.GetPixel(hdc, x, y)  # 提取RGB值         r = pixel & 0x0000ff         g = (pixel & 0x00ff00) >> 8         b = pixel >> 16     except KeyboardInterrupt:         print('\n')      return r,g,b  import tkinter as tk window = tk.Tk() window.wm_attributes('-topmost', 1) window.title(小白取色器) window.geometry('200x100') a = tk.StringVar() l = tk.Label(window, textvariable=a,  # 标签的文字                  bg='green',  # 标签背景颜色                  font=('Arial', 12),  # 字体大小和字体大小                  width=15, height=2  # 标签长度(按字符长度计算)                  ) l.pack()  # 固定窗口位置  while 1:     r,g,b = GetColor()     print(str(r)   ','   str(g)   ','   str(b))     a.set(str(r) ',' str(g) ',' str(b))     l.update()  window.mainloop()

另外,我写了一篇博客,可以获得鼠标的实时位置(带弹出窗口):(48条信息) 实时获取鼠标位置_博客晋升阁-CSDN博客

来踩!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

锐单商城拥有海量元器件数据手册IC替代型号,打造电子元器件IC百科大全!

相关文章