I have a TKinter application which i put together in Visual Studio Code. It runs perfectly fine in Visual Studio Code and does not freeze or anything like that. Because I want my program to run on other pcs as well, I created an .exe file using pyinstaller by running
pyinstaller --onefile -w "main.py"
This creates the desired .exe file without any problems. Sadly when put into an .exe file, my program crashes a lot, by crashing I mean that the window is not responding anymore or that the window just closes itself after some time. I don't know if this is a commom problem but I honestly don't know what to do. Apparently I don't have any problems in my code, because it runs perfectly fine in Visual Studio Code.
Is there anything I can do?
Edit 1: My window freezes around these lines of my code: I am trying to create 4 scales with a for loop:
for i in range(4):
scale = tk.Scale(self.root, state = "disabled", from_ = 100, to = 0)
scale.place(rely=0.2,relx=i*0.25,relwidth=0.25, relheight=0.8)
self.scales.append(scale)
Also I try to put my scales into the list self.scales
so I can work with my scales later on. The program creates the first three scales without any problem but often fails to create the 4th.
EDIT 2: I think I found a solution: Maybe the for loop is just too fast for Tkinter and it can't create the GUI items that fast, I added
time.sleep(0.1)
to my for loop, for now, this seems to work. But I dont really know if thats how its supposed to be.
EDIT 3: Nevermind, this did not solve the problem. The problem has something to do with creating the scales. I dont really know what to do.