برای من این متن را به پی دی اف تبدیل کن


from tkinter import *
from tkinter import filedialog, ttk, messagebox, simpledialog
import datetime
import mysql.connector

# تنظیمات پنجره اصلی
win = Tk()
win.title("Store Management")
win.geometry("800x600")

# ویجت نمایش زمان
Ib_time = Label(win, text="Time", font=("tahoma", 12))
Ib_time.pack()

def show_time():
    t = datetime.datetime.now().strftime("%c")
    Ib_time.config(text=t)
    Ib_time.after(1000, show_time)

show_time()

# ویجت‌های ورودی
Label(win, text="Brand:", font=("tahoma", 12)).place(x=10, y=40)
en_brand = Entry(win, width=20)
en_brand.place(x=100, y=40)

Label(win, text="Color:", font=("tahoma", 12)).place(x=10, y=70)
en_color = Entry(win, width=20)
en_color.place(x=100, y=70)

Label(win, text="Year:", font=("tahoma", 12)).place(x=10, y=100)
en_year = Entry(win, width=20)
en_year.place(x=100, y=100)

Label(win, text="Memory:", font=("tahoma", 12)).place(x=10, y=130)
en_memory = Entry(win, width=20)
en_memory.place(x=100, y=130)

Label(win, text="RAM:", font=("tahoma", 12)).place(x=10, y=160)
combo_ram = ttk.Combobox(win, values=[2, 4, 6, 8, 12], font=("tahoma", 10), width=18)
combo_ram.place(x=100, y=160)

Label(win, text="Wireless:", font=("tahoma", 12)).place(x=10, y=190)
var_wireless = IntVar()
Radiobutton(win, text="Yes", value=1, variable=var_wireless, font=("tahoma", 10)).place(x=100, y=190)
Radiobutton(win, text="No", value=0, variable=var_wireless, font=("tahoma", 10)).place(x=160, y=190)

Label(win, text="Pixel:", font=("tahoma", 12)).place(x=10, y=220)
combo_pixel = ttk.Combobox(win, values=list(range(45, 301)), font=("tahoma", 10), width=18)
combo_pixel.place(x=100, y=220)

# اتصال به دیتابیس
try:
    myconnection = mysql.connector.connect(
        host="localhost",
        user="root",
        password="",
        database="store_management"
    )
    mycursor = myconnection.cursor()
    Ib_state = Label(win, text="Connected!", font=("tahoma", 10), fg="green")
except Exception as e:
    Ib_state = Label(win, text="Connection Error!", font=("tahoma", 10), fg="red")
    messagebox.showerror("Database Error", str(e))
Ib_state.place(x=10, y=5)

# ذخیره محصول
def save_product():
    brand = en_brand.get().strip()
    color = en_color.get().strip()
    year = en_year.get().strip()
    memory = en_memory.get().strip()
    ram = combo_ram.get()
    wireless = "Yes" if var_wireless.get() == 1 else "No"
    pixel = combo_pixel.get()
    date = datetime.datetime.now().strftime("%Y-%m-%d")

    if not (brand and color and year.isdigit() and memory.isdigit() and ram and pixel.isdigit()):
        messagebox.showerror("Error", "Please fill in all fields correctly!")
        return

    try:
        sql = "INSERT INTO products (brand, color, year, memory, ram, wireless, pixel, date_added) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)"
        values = (brand, color, year, memory, ram, wireless, pixel, date)
        mycursor.execute(sql, values)
        myconnection.commit()
        messagebox.showinfo("Success", "Product saved successfully!")
    except Exception as e:
        messagebox.showerror("Error", f"Failed to save product: {str(e)}")

Button(win, text="Save Product", bg="white", font=("tahoma", 10), command=save_product).place(x=10, y=260)

# نمایش محصولات
product_list = Listbox(win, width=50, height=15)
product_list.place(x=350, y=40)

def show_products():
    try:
        mycursor.execute("SELECT * FROM products")
        product_list.delete(0, END)
        for product in mycursor.fetchall():
            product_list.insert(END, product)
    except Exception as e:
        messagebox.showerror("Error", f"Failed to show products: {str(e)}")

Button(win, text="Show Products", bg="orange", font=("tahoma", 10), command=show_products).place(x=10, y=300)

# حذف محصول
def delete_product():