import os
import sys
import tkinter as tk
def resource_path(relative_path):
try:
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
root = tk.Tk()
icon_path = resource_path("icon.ico")
root.iconbitmap(icon_path)
root.mainloop()