From 4a58ce02b70aaab34849f2d4ce0cd438faf3343c Mon Sep 17 00:00:00 2001 From: Chris Mekelburg Date: Sat, 21 Sep 2024 21:17:54 -0400 Subject: [PATCH] first milestone/version drawing project I was able to draw the rings using iteration and the 6 electrons to show a carbon atom. I found the turtle documentation to be helpful in finding some new functions to use such as moving to any spot in the coordinate plane and drawing the electrons as dots. For the next steps, I will try to incorporate some iteration for the drawing of the electrons since it is a repetitive process. I found both in this project and in the typeface problem set that I sometimes need to write the code out a few times before trying to add in the iteration. I then will animate the electrons and hope to be able to incorporate some type of input that enables my drawing to draw a Bohr model for different elements based on the user input, which is my longer term goal. --- drawing.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/drawing.py b/drawing.py index 29fc89e..a84a508 100644 --- a/drawing.py +++ b/drawing.py @@ -5,3 +5,62 @@ # (Briefly describe what this program does.) from turtle import * +from argparse import ArgumentParser +import turtle + +def draw_ring(ring): + radius = ring*50 + circle(radius,360) + penup() + right(90) + forward(50) + left(90) + pendown() + + +def draw_electron(): + pencolor("red") + turtle.dot(15) + +def return_to_center(): + penup() + turtle.goto(0,0) + +'''def position_electrons(number): + return_to_center() + + + circle(radius*2,360) + penup() + right(90) + forward(50) + left(90) + pendown() + circle(radius*3)''' + + +'''parser= ArgumentParser("python drawing.py") +parser.add_argument("radius", type=int) +args = parser.parse_args()''' + + +for ring in range(4): #draws rings + draw_ring(ring) +return_to_center() #returns to center +forward(50) +draw_electron() +back(100) +draw_electron() +return_to_center() +forward(100) +draw_electron() +back(200) +draw_electron() +return_to_center() +right(90) +forward(100) +draw_electron() +back(200) +draw_electron() +input() +