-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChazinho.py
More file actions
60 lines (43 loc) · 1.59 KB
/
Chazinho.py
File metadata and controls
60 lines (43 loc) · 1.59 KB
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
import tkinter as tk
import random
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
def send_email(subject, body, to_email):
sender_email = "seu email"
password = "Key pública"
server = smtplib.SMTP_SSL("smtp.gmail.com", 465)
server.login(sender_email, password)
message = MIMEMultipart()
message["From"] = sender_email
message["To"] = to_email
message["Subject"] = subject
message.attach(MIMEText(body, "plain"))
server.sendmail(sender_email, to_email, message.as_string())
server.quit()
def show_popup():
popup = tk.Toplevel(root)
popup.title("Popup")
label = tk.Label(popup, text="brigadu")
label.pack(padx=20, pady=20)
subject = "Resposta da sua pergunta"
body = "El* aceitou fazer o chá!"
to_email = "email do destinatário"
send_email(subject, body, to_email)
def move_button(event):
max_width = root.winfo_width() - no_button.winfo_width()
max_height = root.winfo_height() - no_button.winfo_height()
x = random.randint(0, max_width)
y = random.randint(0, max_height)
no_button.place(x=x, y=y)
root = tk.Tk()
root.title("Faz um chazinho pra gente?")
root.geometry("400x400")
question_label = tk.Label(root, text="faz um chazinho pra gente?")
question_label.pack(pady=20)
yes_button = tk.Button(root, text="Ta bom, eu faço", command=show_popup)
yes_button.pack()
no_button = tk.Button(root, text="Não")
no_button.place(x=150, y=200)
no_button.bind("<Enter>", move_button)
root.mainloop()