|
|
| import tkinter as tk
|
| import subprocess
|
| import os
|
|
|
| class UFDInterface:
|
| def __init__(self, root):
|
| self.root = root
|
| self.root.title("UFD - Your Friend Desktop")
|
| self.root.geometry("800x400")
|
|
|
| self.characters = [
|
| ("Catman", "gray"), ("Diskdibian", "blue"),
|
| ("Easyceaer", "yellow"), ("USBcowboy", "cyan"), ("Bookman", "green")
|
| ]
|
|
|
| self.top_frame = tk.Frame(root)
|
| self.top_frame.pack(pady=40)
|
|
|
| for name, color in self.characters:
|
| self.create_character(name, color)
|
|
|
| def create_character(self, name, color):
|
| char_frame = tk.Frame(self.top_frame, padx=15)
|
| char_frame.pack(side=tk.LEFT)
|
|
|
|
|
| canvas = tk.Canvas(char_frame, width=100, height=120, highlightthickness=0)
|
| canvas.pack()
|
|
|
|
|
| canvas.create_oval(15, 45, 85, 115, fill=color, outline="black")
|
|
|
| canvas.create_oval(30, 10, 70, 50, fill=color, outline="black")
|
|
|
|
|
|
|
| canvas.create_oval(40, 20, 48, 28, fill="black")
|
| canvas.create_oval(52, 20, 60, 28, fill="black")
|
|
|
| canvas.create_arc(40, 25, 60, 40, start=180, extent=180, outline="red", width=2)
|
|
|
|
|
| lbl = tk.Label(char_frame, text=name, font=("Arial", 12))
|
| lbl.pack(pady=5)
|
|
|
|
|
| if name == "USBcowboy":
|
|
|
| def click_usb(event):
|
|
|
| if os.path.exists("/media/sa"):
|
| subprocess.run(["xdg-open", "/media/sa"])
|
| else:
|
| print("系統內找不到 /media/sa 資料夾!")
|
|
|
|
|
| canvas.bind("<Button-1>", click_usb)
|
| lbl.bind("<Button-1>", click_usb)
|
|
|
| if __name__ == "__main__":
|
| root = tk.Tk()
|
| app = UFDInterface(root)
|
| root.mainloop()
|
|
|