File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
PyGamesScripts/Color-Game Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,19 @@ def changeColor():
3737 global word_color
3838 global word
3939 global word_lbl
40+ global word_color_list
41+ global user_score
4042 word = random .choice (colors )
4143 word_color = random .choice (colors )
44+ word_color_list .append (word_color )
4245 word_lbl .config (text = word )
4346 word_lbl .config (fg = word_color )
47+ if user_score >= 1 :
48+ if word_color_list [user_score - 1 ] != word_color :
49+ word_lbl .config (bg = word_color_list [user_score - 1 ])
50+ else :
51+ word_lbl .config (bg = "Grey" )
52+
4453
4554# increment score if input is correct
4655def check (event ):
@@ -84,12 +93,14 @@ def resetGame():
8493colors = ""
8594word = ""
8695word_color = ""
96+ word_color_list = []
8797boolean = ""
8898# Setup window
8999root = tk .Tk ()
90100root .title ("Color Game - Mudit Choudhary" )
91101root .geometry ("800x510" )
92102
103+
93104# Heading Label
94105tk .Label (root , text = "Remember type the color of the word, not the word text!!" ,
95106 font = ("Comic Sans MS" , 19 ), fg = "#ff6e6e" ).pack (pady = (15 , 0 ))
You can’t perform that action at this time.
0 commit comments