# Program that draws a diamond import cairo import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk from math import pi import time width,height = 1000,700 # This defines the width, height of window win = Gtk.Window() win.connect('destroy', lambda w: Gtk.main_quit()) win.set_default_size(width,height) drawingarea = Gtk.DrawingArea() win.add(drawingarea) ####### For lab 2, modify the following procedure to draw a stick figure: def mydraw(da, brush): scale = 128 # size of diamond, figure x,y = width//2, height//2 # center coordinates brush.set_source_rgb(0,0,1) # blue brush.move_to(x,y-scale) brush.line_to(x+scale,y) brush.line_to(x,y+scale) brush.line_to(x-scale,y) brush.line_to(x,y-scale) brush.stroke() # renders drawing to screen #mydraw ############ Do not modify below this line ############## def main(): drawingarea.connect('draw', mydraw) win.show_all() Gtk.main() if __name__ == '__main__': main()