Welcome to color guessing game with GUI This is the simple color guessing game you can make more complex or hard this game and other is you can add also level to take more interest to user. import tkinter import random import tkinter.simpledialog # List of possible colours. colours = [ 'Red' , 'Blue' , 'Green' , 'Pink' , 'Black' , 'Yellow' , 'Orange' , 'White' , 'Purple' , 'Brown' ] score = 0 incorrect_guesses = 0 # Function to prompt the user for game duration. def getGameDuration (): duration = tkinter.simpledialog.askinteger( "Game Duration" , "Enter game duration in seconds:" ) return duration # Set the game duration by prompting the user. GAME_DURATION = getGameDuration() # The game time left, initially GAME_DURATION seconds. timeleft = GAME_DURATION # Function that will start the game. def startGame (event): if timeleft == GAME_DURATION: # Start ...
Comments