import tkinter as tk
from tkinter import ttk
def show_selected_key():
selected = dropdown.get()
if selected == 'win7':
text_box.delete(1.0, tk.END)
text_box.insert(tk.END, 'win7 key: 123456')
elif selected == 'win10':
text_box.delete(1.0, tk.END)
text_box.insert(tk.END, '1. Windows PowerShell (Admin) \n\n2. irm https://massgrave.dev/get | iex \n\n3. Enter 1 and press Enter')
# 创建主窗口
window = tk.Tk()
window.geometry("720x180")
window.title("Keygen")
window.resizable(False, False)
# 设置窗口背景图
background_image = tk.PhotoImage(file="background.png")
background_label = tk.Label(window, image=background_image)
background_label.place(x=0, y=0, relwidth=1, relheight=1)
# 创建下拉式选择菜单
dropdown = ttk.Combobox(window, values=['win7', 'win10'])
dropdown.pack(side=tk.LEFT, anchor=tk.NW)
#tk.N:北方向(顶部中心)。
#tk.NE:东北方向(右上角)。
#tk.E:东方向(右侧中心)。
#tk.SE:东南方向(右下角)。
#tk.S:南方向(底部中心)。
#tk.SW:西南方向(左下角)。
#tk.W:西方向(左侧中心)。
#tk.NW:西北方向(左上角)。
# 创建文字显示框
text_box = tk.Text(window, height=10, width=50)
#text_box.pack(side=tk.RIGHT)
text_box.place(relx=0.5, rely=0.5, anchor="center")
button = tk.Button(window, text="Show Key", command=show_selected_key)
button.place(relx=0.175, rely=0.5, anchor="center")
#button.pack(side=tk.LEFT, anchor=tk.S)
# 运行主循环
window.mainloop()