Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added GUIScripts/Rock Paper Scissors/Images/Paper.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions GUIScripts/Rock Paper Scissors/Images/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Images
This is a directory for all the images used in the project
Binary file added GUIScripts/Rock Paper Scissors/Images/Rock.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions GUIScripts/Rock Paper Scissors/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Rock Paper Scissors

You all know, rock paper scissors, a.k.a - rps, is one of the most famous games!

SO, go try ur hands at it! And try to win!


# Information
I have created this game using the tkinter library, in which I have used the pillow library to get the images and make the game more interactive,

# Dependencies
```bash
pip install pillow
```

# ScreenShots
![rps](https://camo.githubusercontent.com/d3567b6dfa2f2a8f587a10b643a4b6ca15a846a7c1ccbc0feaba3c4d5924fba6/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3835373437393130333032343230313734302f3839373034313534343734383631373734382f756e6b6e6f776e2e706e67)
![result](https://camo.githubusercontent.com/521f53afca7f819d8b7be6f8f3b753cdfe44ac01307f5b7580932f2658c0d929/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f3838343635313436343030303134373437362f3839373437343233343233323735303039302f756e6b6e6f776e2e706e67)


# Running the file
You can run the file by writing the below command in your terminal/command line
```bash
python rock_paper_scissors.py
```
Be sure to reslove the dependencies before running the program

Enjoy the gane!!
72 changes: 72 additions & 0 deletions GUIScripts/Rock Paper Scissors/rock_paper_scissors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import random
from tkinter import Tk, Button, END, Entry, mainloop, DISABLED, NORMAL
from PIL import Image, ImageTk

root = Tk()
root.title('Rock Paper Scissors')
root.geometry("675x250")
root.config(bg='#83b576')

#results
def Rock():
answer["state"] = NORMAL
answer.delete(0, END)
computer = random.choice(['r', 'p', 's'])
if computer == 'r':
answer.insert(0,f"Draw, you both chose 'rock' ")
elif computer == 'p':
answer.insert(0,f"You lost, computer chose 'paper' defeating you")
else:
answer.insert(0,f"You won!!, computer chose 'scissors' losing to you")
answer["state"] = DISABLED

def Scissors():
answer["state"] = NORMAL
answer.delete(0, END)
computer = random.choice(['r', 'p', 's'])
if computer == 's':
answer.insert(0,f"Draw, you both chose 'scissors'")
elif computer == 'r':
answer.insert(0,f"You lost, computer chose 'rock' defeating you")
else:
answer.insert(0,f"You won!!, computer chose 'paper' losing to you")
answer["state"] = DISABLED

def Paper():
answer["state"] = NORMAL
answer.delete(0, END)
computer = random.choice(['r', 'p', 's'])
if computer == 'p':
answer.insert(0,f"Draw, you both chose 'paper'")
elif computer == 's':
answer.insert(0,f"You lost, computer chose 'scissors' defeating you")
else:
answer.insert(0,f"You won!!, computer chose 'rock' losing to you")
answer["state"] = DISABLED

#buttons
Rock_btn = ImageTk.PhotoImage(Image.open('Images/Rock.jpg'))
Scissors_btn = ImageTk.PhotoImage(Image.open('Images/Scissors.jpg'))
Paper_btn = ImageTk.PhotoImage(Image.open('Images/Paper.jpg'))


Rock_butn = Button(root, image=Rock_btn, command=Rock)
Rock_butn.place(x=75, y=30 )

Paper_butn = Button(root, image=Paper_btn, command = Paper)
Paper_butn.place(x=300, y=25 )

Scissors_butn = Button(root, image=Scissors_btn, command = Scissors)
Scissors_butn.place(x=550, y=25 )


answer = Entry(
root,
width=50,
font=('Courier New', 14),
state = DISABLED
)

answer.place(y=200, x=80)

mainloop()