-
Notifications
You must be signed in to change notification settings - Fork 0
/
ColorPalette.py
92 lines (82 loc) · 3.08 KB
/
ColorPalette.py
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from PyQt5.QtWidgets import QColorDialog , QApplication , QWidget , QPushButton , QTextEdit
from PyQt5.QtGui import QIcon , QFont
from sys import exit,argv
class Main :
def __init__(this) :
this.app = QApplication(argv)
this.icon = QIcon("icon.png")
this.screen_dim = this.app.primaryScreen().size()
this.button_font = QFont("Acknowledgement",pointSize=10)
this.widget = QWidget()
this.widget.setWindowTitle("Color Palette")
this.widget.setFixedSize(297,232)
this.widget.setWindowIcon(this.icon)
##f2ffff
this.widget.setStyleSheet('''
background-color:cyan;
''')
this.color_list_frame = QWidget()
this.colordialog = QColorDialog(this.widget)
this.color_name_list_setup()
def show_color_dialog() :
this.colordialog.show()
this.button = QPushButton(this.icon," Show",this.widget)
this.button.setGeometry(74 ,37,150,75)
this.button.setFont(this.button_font)
this.button.setStyleSheet('''
QPushButton{
border-radius:10px;
background-color:black;
color:cyan;
}
QPushButton::hover{
background-color:#000050;
}
QPushButton::pressed{
background-color:cyan;
color:black;
}
''')
this.button.pressed.connect(show_color_dialog)
def color_list_btn_pressed() :
this.color_list_frame.show()
this.color_list_btn = QPushButton("Color List",this.widget)
this.color_list_btn.setGeometry(74,120,150,75)
this.color_list_btn.setFont(this.button_font)
this.color_list_btn.pressed.connect(color_list_btn_pressed)
this.color_list_btn.setStyleSheet('''
QPushButton{
border-radius:10px;
background-color:black;
color:cyan;
}
QPushButton::hover{
background-color:#000050;
}
QPushButton::pressed{
background-color:cyan;
color:black;
}
''')
this.widget.show()
exit(this.app.exec_())
def color_name_list_setup(this) :
this.color_list_frame.setFixedSize(this.screen_dim.width()//4 , this.screen_dim.height()-100)
this.color_list_frame.setWindowTitle("Color Palette")
this.color_list_frame.setWindowIcon(this.icon)
lst = this.colordialog.customColor(1).colorNames()
st = ""
textedit = QTextEdit( "Available color names :\n"+st ,this.color_list_frame)
textedit.setFixedSize(this.color_list_frame.width() , this.color_list_frame.height())
textedit.setReadOnly(True)
textedit.setStyleSheet('''
background-color:black;
color:cyan;
font-family:Verdana;
font-weight:bold;
font-size:18px;
''')
for i in range(lst.__len__()):
textedit.append(str(i+1)+". "+lst[i]+" .")
if __name__ == "__main__" :
Main()