Hello guys, today we have come up with the python projects as per the request of some of the followers from our instagram (@its.aihub). Today we are here with the tutorial to make simple scissor paper rock game using Tkinter Python.
First of all, let’s understand the rule of Scissor paper rock game. Scissor paper rock is a hand game Screen Recorder With usually played between two person. Player choose three different shapes using hand and fingers. These shapes refers “Rock” , “Scissor” and ” Paper”. A player who decides to choose rock will beat another player who has chosen scissors but loses with the player who has chossen paper. A player who decides to choose paper will beat another player who has chosen rock but loses with the player who has chossen scissor.
Now let’s dive into the code.
So let’s create a window of dimension 300*500 with title as given. We have imported all those required while creating the game.
import tkinter as tk
from PIL import Image,ImageTk
window.title(“Scissor Paper Rock @Diwas “)
For event handling, lets create the function for individual possible events possible
Lets define a function using which computer selects random events from three possible events :
Scissor, Paper & Rock
Here is the main block of codes for the game. User selected event and computer selected event is
compared and result is generated
print(“Sorry !! Com win”)
print(“Congarts !! You win”)
Merging all the codes, final code for the Scissor paper Rock game looks as given below
This page is contributed by DS & his team . If you like AIHUB and would like to contribute, you can also write an article & mail your article to [email protected] . See your articles appearing on AI HUB platform and help other AI Enthusiasts.