Skip to content

Ayusinha/Color-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

"# Color-game"

Introduction:

• Python offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, tkinter is most commonly used method.
• It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with tkinter outputs the fastest and easiest way to create the GUI applications. Creating a GUI using tkinter is an easy task.
• To create a tkinter:

  1. Importing the module – tkinter
  2. Create the main window (container)
  3. Add any number of widgets to the main window
  4. Apply the event Trigger on the widgets.

• Importing tkinter is same as importing any other module in the python code. Note that the name of the module in Python 2.x is ‘Tkinter’ and in Python 3.x is ‘tkinter’.

Command to import tkinter:

     Import tkinter

Tkinter Widgets:

Widgets are something like elements in the HTML. You will find different types of widgets to the different types of elements in the Tkinter.

Let's see the brief introduction to all of these widgets in the Tkinter:
• Button:- Button widget is used to place the buttons in the tkinter.
• Canvas:- Canvas is used to draw shapes in your GUI.
• Checkbutton:- Checkbutton is used to create the check buttons in your application. You can select more than one option at a time.
• Entry:- Entry widget is used to create input fields in the GUI.
• Frame:- Frame is used as containers in the tkinter.
• Label:- Label is used to create a single line widgets like text, images, etc...
• Menu:- Menu is used to create menus in the GUI.

Geometry Management:

All widgets in the tkinter will have some geometry measurements. These measurements give you to organize the widgets and their parent frames, windows, etc...
Tkinter has the following three Geometry Manager classes.
• pack():- It organizes the widgets in the block, which mean it occupies the entire available width. It's a standard method to show the widgets in the window
• grid():- It organizes the widgets in table-like structure. You will see details about grid later in this tutorial.
• place():- It's used to place the widgets at a specific position you want.

Color Game:

• TKinter is widely used for developing GUI applications. Along with applications, we can also use Tkinter GUI to develop games.

• Let’s try to make a game using Tkinter. In this game player has to enter color of the word that appears on the screen and hence the score increases by one, the total time to play this game is 30 seconds.

• Colors used in this game are Red, Blue, Green, Pink, Black, Yellow, Orange, White, Purple and Brown. Interface will display name of different colors in different colors.

• Player has to identify the color and enter the correct color name to win the game.

About

Color game using Tkinter with Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages