Simple Python Gui Program Won't Run, Says Restart
Solution 1:
The good news:
- Your code works (in that it doesn't crash in python3, as is)!
The bad news:
- Your code doesn't do anything :( Your only function would raise an exception if called
- You have a code-unrelated problem
To resolve problem #1, change init
to __init__
and tkinter.tk
to tkinter.Tk()
__init__
is the function called by default on instance construction. The underscores are important if you want to override it. The other issue is just a typo.
You're broader problem is... broader. yes it matters where you save your file. If you don't save it in the place you are running python from, you need to supply an absolute path to it, or a relative path from the place you are running from. This is a broad topic, but pretty important and not too challenging. Maybe try here, or any python tutorial.
I don't know what type F5 does on your computer. I would not in general expect it to run python code. Are you in an IDE, then maybe it does run python code? Are you playing call of duty, because then it's more likely to lob a virtual grenade? F5 is app-dependent, probably not a universal binding on your machine
Post a Comment for "Simple Python Gui Program Won't Run, Says Restart"