-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
57 lines (46 loc) · 1.85 KB
/
main.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
import tkinter as tk
from tkinter import messagebox
import random
import webbrowser
import urllib.parse
# Ganti dengan nomor WhatsApp Anda
whatsapp_number = "Your Number"
pesan = "I want, now we are dating"
def pindah_button(button):
"""Memindahkan tombol ke posisi acak dalam jendela."""
new_x = random.randint(0, window.winfo_width() - button.winfo_width())
new_y = random.randint(0, window.winfo_height() - button.winfo_height())
button.place(x=new_x, y=new_y)
def tekan_ya():
"""Menangani aksi ketika tombol 'Ya' ditekan."""
messagebox.showinfo("Jawaban", "Now you are my partner")
buka_whatsapp()
def tekan_tidak():
"""Menangani aksi ketika tombol 'Tidak' ditekan."""
pindah_button(tidak_button)
def buka_whatsapp():
"""Membuka WhatsApp dengan pesan yang telah dikodekan."""
encoded_message = urllib.parse.quote(pesan)
webbrowser.open_new(f"https://api.whatsapp.com/send?phone={whatsapp_number}&text={encoded_message}")
# Membuat jendela utama
window = tk.Tk()
window.title("Aku Suka Kamu")
window.geometry("400x600")
window.configure(bg='#FFC0CB')
# Membuat frame untuk konten
frame = tk.Frame(window, bg='#FFC0CB', bd=5)
frame.place(relx=0.5, rely=0.5, anchor='center')
# Menambahkan label pertanyaan
label = tk.Label(frame, text="I have a crush on you,\nWant to be my partner?",
font=("Helvetica", 16, "bold"), bg='#FFC0CB', fg='#FF69B4', justify=tk.CENTER)
label.pack(pady=20)
# Tombol 'Ya'
ya_button = tk.Button(frame, text="Yes", font=("Helvetica", 14), command=tekan_ya,
bg='#FF69B4', fg='white', width=8)
ya_button.pack(side=tk.LEFT, padx=10)
# Tombol 'Tidak'
tidak_button = tk.Button(window, text="No", font=("Helvetica", 14), command=tekan_tidak,
bg='#FF69B4', fg='white', width=8)
tidak_button.place(x=50, y=50)
# Menjalankan aplikasi
window.mainloop()