'''graphics2.py Jed Yang, 2016-10-02 Adapted to Python 3 from a program written by Jeff Ondich Started in Pascal by Jeff Ondich on 1/25/95 Ported to C++, Java, and Python Last modified 1/19/07 1. Try it. 2. Identify which corner of the polygon has which coordinates as listed in the source code. 3. Redesign the polygon to be a triangle or a rectangle. Can you do a regular hexagon? 4. What is the default background color of a GraphWin object? ''' from graphics import * window = GraphWin('Polygon demo', 600, 500) polygon = Polygon(Point(200, 100), Point(400, 100), Point(500, 200), Point(400, 300), Point(200, 200)) polygonColor = color_rgb(255, 0, 0) polygon.setOutline(polygonColor) # Some come colours have pre-defined names so you don't have to mix RGB values # with color_rgb(). But then you have less control over the resulting colour. polygonFillColor = 'yellow' polygon.setFill(polygonFillColor) # What is the difference between .setOutline() and .setFill()? polygon.draw(window) # Can you .draw() first and then .setFill() later? # Wait for user input. print('Hit any key to quit') keyResponse = window.getKey() print('You hit', keyResponse) # Which window needs input focus for this to work? Why? # Which keys work?