Gedit problems with python
Question: I'm just learning Python in school and we were suppose to draw something (code
it in gedit for python) on canvas (Tkinter). Instead of getting something
drawn up I only get an empty canvas. [It looks like this on my
computer](https://db.tt/X2vvLfQ9). The code is correct as I copied it from
another web page.

    
    
    from Tkinter import *
    
    master=Tk()
    
    w=Canvas(master, width=200, height=100)
    w.pack
    
    w.create_line(0,0,200,100)
    w.create_line(0,100,200,0, fill="red", dash=(4,4))
    
    w.create_rectangle(50,25,150,75, fill="blue")
    
    mainloop()
    


Answer: Actually, the code is _not_ correct. The person who wrote it forgot to
actually call the [`pack`](http://effbot.org/tkinterbook/pack.htm) method. You
need to add `()` after it to do this:

    
    
    from Tkinter import *
    
    master=Tk()
    
    w=Canvas(master, width=200, height=100)
    ########
    w.pack()
    ########
    
    w.create_line(0,0,200,100)
    w.create_line(0,100,200,0, fill="red", dash=(4,4))
    
    w.create_rectangle(50,25,150,75, fill="blue")
    
    mainloop()
    

Otherwise, the canvas will never be placed on the window.

P.S. You should note that not everything you find on the Web is guaranteed to
be correct. :)

