-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathColorPicker.py
More file actions
25 lines (20 loc) · 762 Bytes
/
ColorPicker.py
File metadata and controls
25 lines (20 loc) · 762 Bytes
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
import pygame
from utils import *
class ColorPicker:
# Color Picker
def pickColor(self,win):
pos = pygame.mouse.get_pos()
if pos[0] < 600 and pos[1] < 600:
color = tuple(
win.get_at(pos)
) # get the color of pixel at mouse position
drawing_color = (color[0], color[1], color[2])
return drawing_color
def preview_zoomed_color(self, win):
pos = pygame.mouse.get_pos()
if pos[0] <600 and pos[1] < 600:
color = tuple(
win.get_at(pos)
)
color_picker_button = Button(pos[0]+10,pos[1] - 50,50,50,(color[0], color[1], color[2]),shape="ellipse",isBorder=True)
color_picker_button.draw(win)