#Importing modules import requests import os import os.path import urllib.request from tkinter import * import random import tkinter as tk from PIL import Image #Creating Folder filename = "D:/MoreLess" if os.path.exists(filename): print("") else: os.mkdir("D:/MoreLess") #Request module is working now url = 'https://icon-icons.com/downloadimage.php?id=128223&root=2090/ICO/512/&file=up_down_icon_128223.ico' r = requests.get(url, allow_redirects=True) open('logo.ico', 'wb').write(r.content) urllib.request.urlretrieve(url, 'D:/MoreLess/logo.png') filename = r'D:/MoreLess/logo.png' img = Image.open(filename) img.save('D:/MoreLess/logo.ico') #Creating GUI and Random functions root = Tk(className = "more or less game") root.geometry("270x105") root.resizable(width=False, height=False) root.iconbitmap('D:/MoreLess/logo.ico') l1 = Label(root, text="") l1.pack() def b1press(): rndm = random.randrange(-1000,1000,1) if rndm > 0: l1.config(text="Win") root.configure(bg='Green') elif rndm < 0: l1.config(text="Lose") root.configure(bg='Red') l2.config(text="Your number was " + str(rndm)) def b2press(): rndm = random.randrange(-1000,1000,1) if rndm > 0: l1.config(text="Lose") root.configure(bg='Red') elif rndm < 0: l1.config(text="Win") root.configure(bg='Green') l2.config(text="Your number was " + str(rndm)) def b3press(): l2.config(text="Your number was ") b1 = Button(root, text = "More", command = b1press).pack() b2 = Button(root, text = "Less ", command = b2press).pack() l2 = Label(root, text="") l2.pack() root.mainloop()
Если запустить то все ок но когда юзаю pyinstaller то пишет такая ошибка: ValueError: Received icon path ‘D:\MoreLess’ which exists but is not in the correct format. On Windows, only ‘.ico’ images or other ‘.exe’ files may be used as icons. Please convert your ‘' file to a ’.ico' then try again.
Не понимаю как бороться с этим…