Hello,
I made a very basic BMI calculator using the tkinter library, that opens an input window, then a message box once you click the “calculate” button.
I used the .pyw extension to run the script without the shell opening, and it worked well.
But once I tried adding a picture to the button, it stopped opening. The picture is saved in an assets folder, located itself inside the same folder as my script.
By commenting lines, I narrowed down the faulty line to this one :
calculator_image = tk.PhotoImage(file = “./assets/calculator_20x20.png”)
The wierd thing is, when I make a copy of the script, but with the .py extension, and run it from the editor (Spyder), it works just fine.
Any ideas why this is happening?
Thanks in advance !
submitted by /u/Queasy_Landscape_761
[link] [comments]
r/learnpython Hello, I made a very basic BMI calculator using the tkinter library, that opens an input window, then a message box once you click the “calculate” button. I used the .pyw extension to run the script without the shell opening, and it worked well. But once I tried adding a picture to the button, it stopped opening. The picture is saved in an assets folder, located itself inside the same folder as my script. By commenting lines, I narrowed down the faulty line to this one : calculator_image = tk.PhotoImage(file = “./assets/calculator_20x20.png”) The wierd thing is, when I make a copy of the script, but with the .py extension, and run it from the editor (Spyder), it works just fine. Any ideas why this is happening? Thanks in advance ! submitted by /u/Queasy_Landscape_761 [link] [comments]
Hello,
I made a very basic BMI calculator using the tkinter library, that opens an input window, then a message box once you click the “calculate” button.
I used the .pyw extension to run the script without the shell opening, and it worked well.
But once I tried adding a picture to the button, it stopped opening. The picture is saved in an assets folder, located itself inside the same folder as my script.
By commenting lines, I narrowed down the faulty line to this one :
calculator_image = tk.PhotoImage(file = “./assets/calculator_20x20.png”)
The wierd thing is, when I make a copy of the script, but with the .py extension, and run it from the editor (Spyder), it works just fine.
Any ideas why this is happening?
Thanks in advance !
submitted by /u/Queasy_Landscape_761
[link] [comments]