Skip to content

Commit 9a83b42

Browse files
authored
Merge pull request larymak#101 from oyerohabib/oyerohabib-3
flames game
2 parents b500a69 + f3a0f7b commit 9a83b42

File tree

5 files changed

+102
-12
lines changed

5 files changed

+102
-12
lines changed

Flames_Game/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Flames Game
2+
3+
*Requirements*
4+
- Python: Download it from: https://www.python.org/downloads/
5+
- tkinter
6+
7+
Run the file and give your input of both names and click "Flame" button.
8+
Enjoy the game
9+
10+
### A visuals of the game
11+
<img src="https://github.com/oyerohabib/Python-project-Scripts/blob/oyerohabib-3/Flames_Game/flame-game.png">

Flames_Game/flame-game.png

4.6 KB
Loading

Flames_Game/flames_game_gui.py

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
from tkinter import *
2+
3+
4+
def clear_all():
5+
Player1_field.delete(0, END)
6+
Player2_field.delete(0, END)
7+
Status_field.delete(0, END)
8+
# set focus on the Player1_field entry box
9+
Player1_field.focus_set()
10+
11+
12+
def tell_status():
13+
p1 = Player1_field.get()
14+
p2 = Player2_field.get()
15+
p1 = p1.replace(" ", "")
16+
p2 = p2.replace(" ", "")
17+
p1 = list(p1)
18+
p2 = list(p2)
19+
20+
Status_field.insert(10, result_flame(p1, p2))
21+
22+
23+
def result_flame(x, y):
24+
for i in x[:]:
25+
if i in y:
26+
x.remove(i)
27+
y.remove(i)
28+
count = len(x) + len(y)
29+
result = ["Friends", "Love", "Affection", "Marriage", "Enemy", "Siblings"]
30+
while len(result) > 1:
31+
split_index = (count % len(result) - 1)
32+
if (split_index >= 0):
33+
right = result[split_index + 1:]
34+
left = result[: split_index]
35+
result = right + left
36+
else:
37+
result = result[: len(result) - 1]
38+
return result
39+
40+
41+
if __name__ == "__main__":
42+
# Create a GUI window
43+
root = Tk()
44+
# Set the background colour of GUI window
45+
root.configure(background='light pink')
46+
# Set the configuration of GUI window
47+
root.geometry("350x125")
48+
# set the name of tkinter GUI window
49+
root.title("Flames Game")
50+
# Create a Player 1 Name: label
51+
label1 = Label(root, text="Name 1 ", fg='black', bg='light green')
52+
# Create a Player 2 Name: label
53+
label2 = Label(root, text="Name 2 ", fg='black', bg='light blue')
54+
# Create a Relation Status: label
55+
label3 = Label(root, text="Relationship Status", fg='black', bg='#FFE4C4')
56+
# grid method is used for placing
57+
# the widgets at respective positions
58+
# in table like structure.
59+
label1.grid(row=1, column=0, sticky="E")
60+
label2.grid(row=2, column=0, sticky="E")
61+
label3.grid(row=4, column=0, sticky="E")
62+
# Create a text entry box
63+
# for filling or typing the information.
64+
Player1_field = Entry(root)
65+
Player2_field = Entry(root)
66+
Status_field = Entry(root)
67+
# grid method is used for placing
68+
# the widgets at respective positions
69+
# in table like structure.
70+
# ipadx keyword argument set width of entry space.
71+
Player1_field.grid(row=1, column=1, ipadx="50")
72+
Player2_field.grid(row=2, column=1, ipadx="50")
73+
Status_field.grid(row=4, column=1, ipadx="50")
74+
# Create a Submit Button and attached
75+
# to tell_status function
76+
button1 = Button(root, text="Flame", bg="#FF7F50",
77+
fg="black", command=tell_status)
78+
79+
# Create a Clear Button and attached
80+
# to clear_all function
81+
button2 = Button(root, text="Clear", bg="#CD5C5C",
82+
fg="black", command=clear_all)
83+
84+
# grid method is used for placing
85+
# the widgets at respective positions
86+
# in table like structure.
87+
button1.grid(row=3, column=1)
88+
button2.grid(row=5, column=1)
89+
90+
# Start the GUI
91+
root.mainloop()

WebScraping/posts/0.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

WebScraping/posts/1.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy