-
Notifications
You must be signed in to change notification settings - Fork 0
/
PedraPapelOuTesoura_.py
174 lines (117 loc) · 3.91 KB
/
PedraPapelOuTesoura_.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
from tkinter import *
import tkinter as tk
from random import randint as r
from time import sleep as s
voce = 0
pc = 0
def pedra1():
s(0.5)
if r(1, 3) == 1:
output = Label(Tela, width=18, text='Empatou!!\n Também escolhi Pedra')
output['bg'] = 'red'
output.place(x=140, y=80)
elif r(1, 3) == 2:
output = Label(Tela, width=18, text='Ganhei!!\n Eu escolhi Papel')
output['bg'] = 'red'
output.place(x=140, y=80)
global pc
pc += 1
pc_ = Label(Tela, text='Você: {}'.format(pc))
pc_['bg'] = 'red'
pc_.place(x=150, y=200)
else:
output = Label(Tela, width=18, text='Perdi!!\n Eu escolhi Tesoura')
output['bg'] = 'red'
output.place(x=140, y=80)
global voce
voce += 1
voce_ = Label(Tela, text='Você: {}'.format(voce))
voce_['bg'] = 'red'
voce_.place(x=15, y=200)
def papel1():
s(0.5)
if r(1, 3) == 1:
output = Label(Tela, width=18, text='Perdi!!\n Eu escolhi Pedra')
output['bg'] = 'red'
output.place(x=140, y=80)
global voce
voce += 1
voce_ = Label(Tela, text='Você: {}'.format(voce))
voce_['bg'] = 'red'
voce_.place(x=15, y=200)
elif r(1, 3) == 2:
output = Label(Tela, width=18, text='Empatou!!\n Também escolhi Papel')
output['bg'] = 'red'
output.place(x=140, y=80)
else:
output = Label(Tela, width=18, text='Ganhei!!\n Eu escolhi Tesoura')
output['bg'] = 'red'
output.place(x=140, y=80)
global pc
pc += 1
pc_ = Label(Tela, text='Você: {}'.format(pc))
pc_['bg'] = 'red'
pc_.place(x=150, y=200)
def tesoura1():
s(0.5)
if r(1, 3) == 1:
output = Label(Tela, width=18, text='Ganhei!!\n Eu escolhi Pedra')
output['bg'] = 'red'
output.place(x=140, y=80)
global pc
pc += 1
pc_ = Label(Tela, text='Você: {}'.format(pc))
pc_['bg'] = 'red'
pc_.place(x=150, y=200)
elif r(1, 3) == 2:
output = Label(Tela, width=18, text='Perdi!!\n Eu escolhi Papel')
output['bg'] = 'red'
output.place(x=140, y=80)
global voce
voce += 1
voce_ = Label(Tela, text='Você: {}'.format(voce))
voce_['bg'] = 'red'
voce_.place(x=15, y=200)
else:
output = Label(Tela, width=18, text='Empatou!!\nTambém escolhi Tesoura')
output['bg'] = 'red'
output.place(x=140, y=80)
Tela = Tk()
Tela.title('Pedra, Paper ou Tesoura')
Tela.geometry('300x300+150+200')
imagem = tk.PhotoImage(file='Fundo.png')
w = tk.Label(Tela, image=imagem)
w.imagem = imagem
w.pack()
a = Label(Tela, text='Vamos jogar Pedra, Papel ou Tesoura')
a['bg'] = 'red'
a.place(x=50, y=10)
pedra = Button(Tela, width=15, text='Pedra', command=pedra1)
pedra['bg'] = 'red'
pedra.place(x=20, y=30)
papel = Button(Tela, width=15, text='Papel', command=papel1)
papel['bg'] = 'red'
papel.place(x=20, y=60)
tesoura = Button(Tela, width=15, text='Tesoura', command=tesoura1)
tesoura['bg'] = 'red'
tesoura.place(x=20, y=90)
voce_ = Label(Tela, text='Você: {}'.format(voce))
voce_['bg'] = 'red'
voce_.place(x=15, y=200)
pc_ = Label(Tela, text='Você: {}'.format(pc))
pc_['bg'] = 'red'
pc_.place(x=150, y=200)
output = Label(Tela, width=17, text='')
output['bg'] = 'red'
output.place(x=140, y=30)
decoracao= '''
-=-=-=-=-=-=-=-=-=-=
____________________
____________________
____________________
-=-=-=-=-=-=-=-=-=-=
'''
deco = Label(Tela, width=18, text=decoracao)
deco['bg'] = 'red'
deco.place(x=140, y=30)
Tela.mainloop()