import qrcode
from PIL import Image, ImageTk
from tkinter import filedialog, Tk, Button, Label, Entry, messagebox, colorchooser, Toplevel
from tkinter import Radiobutton, StringVar
import webbrowser
qr_color = "black"
bg_color = "white"
theme = "light"
def create_qr_code():
data_type = data_type_var.get()
data = entry.get()
if not data:
messagebox.showwarning("Uyarı", "Lütfen veri girin!")
return
qr = qrcode.QRCode(version=1, box_size=10, border=5)
qr.add_data(data)
qr.make(fit=True)
img = qr.make_image(fill=qr_color, back_color=bg_color)
if logo_path:
logo = Image.open(logo_path)
logo = logo.resize((60, 60))
pos = ((img.size[0] - logo.size[0]) // 2, (img.size[1] - logo.size[1]) // 2)
img.paste(logo, pos, mask=logo)
save_path = filedialog.asksaveasfilename(defaultextension=".png", filetypes=[("PNG files", "*.png")])
if save_path:
img.save(save_path)
messagebox.showinfo("Başarılı", f"QR Kod kaydedildi: {save_path}")
def choose_qr_color():
global qr_color
qr_color = colorchooser.askcolor()[1]
def choose_bg_color():
global bg_color
bg_color = colorchooser.askcolor()[1]
def add_logo():
global logo_path
logo_path = filedialog.askopenfilename(title="Bir logo seçin", filetypes=[("Image files", "*.png;*.jpg;*.jpeg")])
def change_theme():
global theme
if theme == "light":
root.config(bg="black")
theme = "dark"
else:
root.config(bg="white")
theme = "light"
def share_qr_code():
save_path = filedialog.askopenfilename(title="QR Kodu seçin", filetypes=[("PNG files", "*.png")])
if save_path:
webbrowser.open(f"mailto:?subject=QR Kodu&body=Oluşturduğum QR kodu paylaşıyorum.&attachment={save_path}")
root = Tk()
root.title("CheatGlobal QR Kod Oluşturucu")
root.geometry("400x400")
logo_path = None
data_type_var = StringVar(value="text")
Label(root, text="QR Kod Türü Seçin:").grid(row=0, column=0, columnspan=2, pady=5)
Radiobutton(root, text="Metin", variable=data_type_var, value="text").grid(row=1, column=0, sticky="w")
Radiobutton(root, text="URL", variable=data_type_var, value="url").grid(row=1, column=1, sticky="w")
Radiobutton(root, text="E-posta", variable=data_type_var, value="email").grid(row=2, column=0, sticky="w")
Radiobutton(root, text="Telefon No", variable=data_type_var, value="phone").grid(row=2, column=1, sticky="w")
Label(root, text="QR Kod için veri girin:").grid(row=3, column=0, columnspan=2, pady=10)
entry = Entry(root, width=30)
entry.grid(row=4, column=0, columnspan=2, pady=5)
Button(root, text="QR Kod Rengini Seç", command=choose_qr_color).grid(row=5, column=0, pady=5)
Button(root, text="Arka Plan Rengini Seç", command=choose_bg_color).grid(row=5, column=1, pady=5)
Button(root, text="Logo Ekle", command=add_logo).grid(row=6, column=0, pady=5)
Button(root, text="QR Kod Oluştur", command=create_qr_code).grid(row=6, column=1, pady=5)
Button(root, text="Tema Değiştir", command=change_theme).grid(row=7, column=0, pady=5)
Button(root, text="QR Kodu Paylaş", command=share_qr_code).grid(row=7, column=1, pady=5)
root.mainloop()