Rock Paper Sccissor Game
Rock Paper Sccissor Game
INTRODUCTION:
Rock, paper, scissors is a game played by using hands which can also
be used as a toss when a decision on something between two or more
people cannot be made.
To play this game, participants say “rock, paper, scissors” and then put
their hands forward forming the shape of either of the three. Making
a fist represents rock, an open hand with palm facing down represents
paper and two fingers (index and middle finger) extended represents
scissors.
In this article, we will walk through how to make a rock paper scissor
game in Python.
HOW TO PLAY ROCK PAPER SCISSOR GAME ?
To play Rock Paper Scissor, follow these steps:
# Create Object
root = tkinter.Tk()
# Set geometry
root.geometry("400x400")
# Set title
root.title("Rock-Paper-Scissors Game")
# Computer Value
computer_dict = {
"0": "Rock",
"1": "Paper",
"2": "Scissors"
}
frame = tkinter.Frame(root)
frame.pack()
l1 = tkinter.Label(frame,
text="Player",
font=10)
l2 = tkinter.Label(frame,
text="VS ",
font="Consolas")
l4 = tkinter.Label(root,
text="",
font="Consolas",
bg="white",
width=15 ,
borderwidth=2,
relief="solid")
l4.pack(pady=20)
frame1 = tkinter.Frame(root)
frame1.pack()
b1 = tkinter.Button(frame1, text="Rock",
font=8, width=7, bg="light blue",
command=player_rock)
b2 = tkinter.Button(frame1, text="Paper",
font=8, width=7, bg="light blue",
command=player_paper)
b3 = tkinter.Button(frame1, text="Scissors",
font=8, width=7, bg="light blue",
command=player_scissors)
b1.pack(side='left', padx=10)
b2.pack(side='left', padx=10)
b3.pack(padx=10)
# Execute Tkinter
root.mainloop()
Output: