11from tkinter import *
2- from tkinter import simpledialog , messagebox , ttk , colorchooser
2+ from tkinter import simpledialog , messagebox , ttk
3+ from vextrackLib import colorButton
34
45class AddGoalDiag (simpledialog .Dialog ):
56 def __init__ (self , parent , title , name = None , amount = None , color = "#FF0000" , edit = False ):
@@ -11,8 +12,7 @@ def __init__(self, parent, title, name=None, amount=None, color="#FF0000", edit=
1112 super ().__init__ (parent , title )
1213
1314 def changeColor (self ):
14- self .color = colorchooser .askcolor (title = "Choose Color" , color = self .color )[1 ]
15- self .colorPreview .configure (bg = self .color )
15+ self .color = self .colorBtn .color
1616
1717 def body (self , frame ):
1818 self .iconbitmap ("VexTrack.exe" )
@@ -30,11 +30,9 @@ def body(self, frame):
3030 if self .xpAmount != None : self .xpAmountBox .insert (0 , self .xpAmount )
3131
3232 ttk .Label (frame , text = "Color" ).grid (padx = 8 , pady = 4 , column = 0 , row = 2 , sticky = "w" )
33- self .colorPreview = Frame (frame , width = 16 , height = 16 , bg = self .color )
34- self .colorPreview .grid (padx = 8 , pady = 4 , column = 1 , row = 2 , sticky = "w" )
3533
36- colorBtn = ttk . Button (frame , text = "Change Color" , command = self .changeColor )
37- colorBtn .grid (padx = 8 , pady = 4 , column = 2 , row = 2 , sticky = "e " )
34+ self . colorBtn = colorButton . ColorButton (frame , color = self . color , command = self .changeColor )
35+ self . colorBtn .grid (padx = 8 , pady = 4 , column = 2 , row = 2 , sticky = "we " )
3836
3937 self .changeStartXPVar = IntVar ()
4038
0 commit comments