Ejemplo n.º 1
0
 def test_howto_example_drawing_rectangle(self):
     """tests the fourth canvas example from howto"""
     test_image = get_image("canvas_4.png")
     o = get_mock_output()
     c = Canvas(o, name=c_name)
     c.rectangle((10, 4, 20, "-10"))
     assert(imgs_are_equal(c.get_image(), test_image))
Ejemplo n.º 2
0
def draw_field():
	c = Canvas(o)
	c.rectangle((0, 0, width-1, height-1))
	c.point(snake)
	if not(applex and appley):
		create_apple()
	if level == 1:		# We draw the apple
		c.point([(applex, appley-1),									# the leaf
			(applex-1, appley),(applex, appley),(applex+1, appley),	# the top half
			(applex-1, appley+1),(applex, appley+1),(applex+1, appley+1)]) # the lower half
	else:
		c.point((applex, appley))
	c.display() 		# Display the canvas on the screen