title: Python Tkinter not working in a .py file
body: <p>My problem is that my python code is not working when I run it as a .py file. Here is the code: </p>
  
  <pre><code>import tkinter
  tk=tkinter.Tk()
  canvas=tkinter.Canvas(tk, width=500, height=500)
  canvas.pack()
  </code></pre>
  
  <p>There is more code to it than that, but that is the relevant stuff. It works fine when I use the python shell or type it directly into the python console, but when I run it as a .py file, it seems to skip this code and go on to the rest, without displaying a canvas. I am using windows, but I am not sure what version of python I'm using.</p>
  
  <p>I was also using 
  <code>from * import tkinter</code>
  before, with relevant changes to the code and i changed it to try and help fix it. It didn't work :(</p>