# Draw several notes on the screen using functions from SimpleGraphics import * # # Draw a note consisting of a head, stem and tail # # Parameters: # x, y: The location of the center of the head of the note # r, g, b: The (optional) color of the note (defaults to black) # # Returns: (None) # def drawNoteTail(x, y, r=0, g=0, b=0): drawNote(x, y, r, g, b) curve(x+10, y-50, x+10, y-40, x+25, y-30, x+20, y-20) # # Draw a note consisting of a head and a stem # # Parameters: # x, y: The location of the center of the head of the note # r, g, b: The (optional) color of the note (defaults to black) # # Returns: (None) # def drawNote(x, y, r=0, g=0, b=0): setColor(r, g, b) ellipse(x-10, y-5, 20, 10) # Head of the note line(x+10, y, x+10, y-50) # Stem of the note # # Draw several notes with different locations and colors. # # Parameters: (None) # # Returns: (None) # def main(): drawNote(100, 100, 255, 0, 0) drawNoteTail(200, 80, g=255) drawNote(300, 120, b=255) drawNote(400, 100) drawNoteTail(500, 80, 255) main()