generated from mwc/project_drawing
108 lines
2.2 KiB
Python
108 lines
2.2 KiB
Python
# drawing.py
|
|
# ----------
|
|
# By ____(you)___________
|
|
#
|
|
# (Briefly describe what this program does.)
|
|
|
|
from turtle import *
|
|
from argparse import ArgumentParser
|
|
import turtle
|
|
from superturtle.animation import animate
|
|
from superturtle.easing import easeInCirc
|
|
from animation import name
|
|
|
|
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 frame in animate(frames=50):
|
|
with frame.rotate(0, 360):
|
|
circle(100)
|
|
input()'''
|
|
|
|
'''for x in range(500):
|
|
for y in range(500):
|
|
|
|
for frame in animate(frames=30):
|
|
with frame.translate([0, 0], [x,y], easing = easeInCirc):
|
|
draw_electron()'''
|
|
|
|
|
|
print(name)
|
|
choice = input("What is your element?")
|
|
elements = ["H", "He", "Li", "Be", "B"]
|
|
if choice in elements:
|
|
electron_number = elements.index(choice) + 1
|
|
print(electron_number)
|
|
|
|
else:
|
|
print("error")
|
|
|
|
|
|
for ring in range(4): #draws rings
|
|
draw_ring(ring)
|
|
return_to_center() #returns to center
|
|
|
|
for electron in range(1,electron_number+1,1):
|
|
if electron < 2:
|
|
|
|
#if electron % 2 == 1:
|
|
forward(50)
|
|
draw_electron()
|
|
return_to_center()
|
|
if electron ==2:
|
|
back(50)
|
|
draw_electron()
|
|
return_to_center
|
|
if electron ==3:
|
|
forward(100)
|
|
draw_electron()
|
|
return_to_center()
|
|
if electron ==4:
|
|
back(100)
|
|
draw_electron()
|
|
return_to_center()
|
|
|
|
input()
|
|
'''
|
|
draw_electron()
|
|
|
|
right(90)
|
|
forward(100)
|
|
draw_electron()
|
|
back(200)''' |