Created
February 19, 2021 04:11
-
-
Save brentxphillips/a68416772a0aa33ec84b0b4bd4fae3a0 to your computer and use it in GitHub Desktop.
Two rocks, background
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Brent Phillips | |
# CS 5001/5003 Spring 2021 | |
# Two rocks, background and fill | |
import graphicsPlus as gr | |
win = gr.GraphWin("Simple Circle", 400, 400) | |
win.setBackground("#072BB8") | |
def rock1(x, y): | |
poly = gr.Polygon(gr.Point(x,y), gr.Point(x + 20,y + 10), gr.Point(x + 40,y + 30), gr.Point(x + 45,y + 42), gr.Point(x + 20,y + 80), gr.Point(x - 20,y + 80), gr.Point(x - 40,y + 40), gr.Point(x - 20,y + 20)) | |
poly.setFill("#1729a1") | |
poly.draw(win) | |
circle1 = gr.Circle(gr.Point(x + 15, y + 30), 5) | |
circle1.setFill("black") | |
circle1.draw(win) | |
circle2 = gr.Circle(gr.Point(x + 30, y + 40), 6) | |
circle2.setFill("black") | |
circle2.draw(win) | |
circle2 = gr.Circle(gr.Point(x - 25, y + 45), 4) | |
circle2.setFill("black") | |
circle2.draw(win) | |
def rock2(x, y, scale): | |
poly = gr.Polygon(gr.Point(x,y), gr.Point(x + 20,y + 10), gr.Point(x + 40,y + 30), gr.Point(x + 45,y + 42), gr.Point(x + 20,y + 80), gr.Point(x - 20,y + 80), gr.Point(x - 40,y + 40), gr.Point(x - 20,y + 20)) | |
poly.setFill("#1729a1") | |
poly.draw(win) | |
circle1 = gr.Circle(gr.Point(x + 15, y + 30), 5 * scale) | |
circle1.setFill("black") | |
circle1.draw(win) | |
circle2 = gr.Circle(gr.Point(x + 30, y + 40), 6) | |
circle2.setFill("black") | |
circle2.draw(win) | |
circle2 = gr.Circle(gr.Point(x - 25, y + 45), 4) | |
circle2.setFill("black") | |
circle2.draw(win) | |
rock1(200, 200) | |
rock2(300, 150, 2) | |
win.getMouse() | |
win.close | |
if __name__ == "__main__": | |
draw_shapes() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment