@@ -36,7 +36,7 @@ def Setup(self):
3636 self .setWindowTitle ('Colorbox' )
3737 self .setFixedSize (150 , 300 )
3838
39- def addPallette (self , pallet ):
39+ def addPallette (self , pallet ): #TODO EXTRA: make this into one vertical line of colors
4040 pallet .setGeometry (self .toolsX , self .toolsY , 40 , 40 )
4141 self .layout ().addWidget (pallet )
4242 self .toolsX += 50
@@ -103,7 +103,8 @@ def create_button(self):
103103
104104class PalletteButton :
105105 """Class for color pallete; allows for mixing color"""
106- def __init__ (self ):
106+ def __init__ (self , parentBtn ):
107+ self .parentBtn = parentBtn
107108 self .r = randint (0 , 255 )
108109 self .g = randint (0 , 255 )
109110 self .b = randint (0 , 255 )
@@ -155,6 +156,11 @@ def mixColor(self, tool):
155156 tool .toolName = "A bucket filled"
156157 tool .PaintBoard .connectTool (tool )
157158 tool .duration = tool .constDuration
159+
160+
161+ self .parentBtn .setStyleSheet ("background-color: rgba{0}" .format (
162+ self .palletteColor ))
163+
158164 print (self .r , self .g , self .b )
159165
160166
@@ -267,8 +273,8 @@ def connectTool(self, curTool=None):
267273 self .setCursor (QCursor (
268274 QPixmap ("Design/icons/{}.png" .format (self .currentTool .toolName
269275 if self .currentTool
270- else None
271- ) )))
276+ else None )
277+ )))
272278
273279 # TODO: make a variable self.currentTool
274280 # that'll hold the current selected tool, i fixed the class
@@ -283,12 +289,12 @@ def colorBoxRun(self):
283289
284290 p1 , p2 , p3 , p4 , p5 , p6 = (QPushButton () for _ in range (6 ))
285291
286- c1 = PalletteButton ()
287- c2 = PalletteButton ()
288- c3 = PalletteButton ()
289- c4 = PalletteButton ()
290- c5 = PalletteButton ()
291- c6 = PalletteButton ()
292+ c1 = PalletteButton (p1 )
293+ c2 = PalletteButton (p2 )
294+ c3 = PalletteButton (p3 )
295+ c4 = PalletteButton (p4 )
296+ c5 = PalletteButton (p5 )
297+ c6 = PalletteButton (p6 )
292298
293299 p1 .setStyleSheet ("background-color: rgba{0}; border-radius:50px"
294300 .format (c1 .palletteColor ))
0 commit comments