Im using auto-py-to-exe
with img = tkinter.Image("photo", file = "./square.png")
. (i did import tkinter
) It works by running it through the .py file but after i convert it in --onefile
mode using auto-py-to-exe
it just says that the file is non-existant. Strangely if I copy/paste a square.png
beside the .exe
file it works using that image.
Here's the full code.
import turtle
import tkinter
import time
import random
s = turtle.Screen()
t = turtle.Turtle()
turtle.title("Pixel")
img = tkinter.Image("photo", file = "./square.png")
turtle._Screen._root.iconphoto(True, img)
#[turtle drawing stuff below.]