Here is the code that i try to execute when i have this problem...
[code]
try:
# Python2
import Tkinter as tk
except ImportError:
# Python3
import tkinter as tk
# create the main window
root = tk.Tk()
root.title("the drawing canvas")
# create the drawing canvas
canvas = tk.Canvas(root, width=600, height=500, bg='white')
canvas.pack()
# now let's draw a red line on the canvas object
# from coordinate points x=10, y=100 to x=400, y=50
canvas.create_line(10, 100, 400, 50, fill="red")
# another 2 lines
canvas.create_line(10, 100, 400, 75, fill="red")
canvas.create_line(10, 100, 400, 100, fill="red")
# now let's draw a red line on the canvas object
# from coordinate points x=10, y=100 to x=400, y=50
canvas.create_line(400, 100, fill="red")
# a blue rectangle with upper left corner x=10, y=15
# and lower right corner x=150, y=75
canvas.create_rectangle(10, 15, 150, 75, fill="blue")
# an oval is drawn within a given rectangle
# a square will give a circle
rect = (50, 110, 250, 310)
# optionally draw the outline of the rectangle
canvas.create_rectangle(rect)
canvas.create_oval(rect, fill='red')
# a circle in a circle
# outer circle first
rect = (350, 110, 550, 310)
canvas.create_oval(rect, fill='blue')
# now the inner circle
q = 50
rect = (350+q, 110+q, 550-q, 310-q)
canvas.create_oval(rect, fill='yellow')
# some circles drawn with a loop
for x in range(10, 450, 20):
rect = (x, 320, x+160, 480)
canvas.create_oval(rect) #, fill='magenta')
# start the GUI event loop
root.mainloop()
[/code]