Back to Parent

import eventBasedAnimation
from math import *
from structClass import *
from Tkinter import *


class Person(object):
	def __init__(self, name, matrix, concepts, calc1, calc2, calc3, diffeq, x, y):
		self.name = name
		self.matrix = matrix
		self.concepts = concepts
		self.calc1 = calc1
		self.calc2 = calc2
		self.calc3 = calc3
		self.diffeq = diffeq
		self.x = x
		self.y = y
		self.r = 60

	def draw(self, canvas, time):
		extend = 25
		r = extend*max(0, (self.matrix-1.9))
		canvas.create_arc(self.x-r, self.y-r, self.x+r, self.y+r, fill="red", start=0+time, extent=60, outline="black")
		r = extend*max(0, (self.concepts-1.9))
		canvas.create_arc(self.x-r, self.y-r, self.x+r, self.y+r, fill="purple", start=60+time, extent=60, outline="black")
		r = extend*max(0, (self.calc1-1.9))
		canvas.create_arc(self.x-r, self.y-r, self.x+r, self.y+r, fill="green", start=120+time, extent=60, outline="black")
		r = extend*max(0, (self.calc2-1.9))
		canvas.create_arc(self.x-r, self.y-r, self.x+r, self.y+r, fill="yellow", start=180+time, extent=60, outline="black")
		r = extend*max(0, (self.calc3-1.9))
		canvas.create_arc(self.x-r, self.y-r, self.x+r, self.y+r, fill="blue", start=240+time, extent=60, outline="black")
		r = extend*max(0, (self.diffeq-1.9))
		canvas.create_arc(self.x-r, self.y-r, self.x+r, self.y+r, fill="pink", start=300+time, extent=60, outline="black")
		canvas.create_text(self.x, self.y+self.r, text=self.name)
		



class movingLineAnimation(eventBasedAnimation.Animation):
	def onInit(self):
		self.col = 3
		self.row = 3
		self.angle = 0
		xdis = 450/(self.col)
		ydis = 450/(self.row)
		self.people = [Person("Irina", 4.21, 4.38, 3.73, 0, 4.08, 4.27, xdis*1, ydis*1), 
					   Person("Mariaon", 0, 0, 2.89, 2.94, 0, 0, xdis*2, ydis*1), 
					   Person("Handron", 3.72, 0, 3.73, 0, 0, 4.45, xdis*3, ydis*1),
					   Person("Flaherty", 4.32, 3.75, 5, 0, 3.71, 0, xdis*1, ydis*2), 
					   Person("Mackey",0, 4.76, 4.64, 4.81, 0, 0, xdis*2, ydis*2), 
					   Person("Mihai", 3.76, 0, 0, 0, 3.37, 4.05, xdis*3, ydis*2), 
					   Person("Greggo", 0, 4.31, 0, 3.66, 3.33, 4.03, xdis*1, ydis*3),
					   Person("Gutman", 0, 4, 0, 0, 0, 0, xdis*2, ydis*3),
					   Person("Pkolli",0 ,0, 2, 0, 0, 0, xdis*3, ydis*3)
					   ]
		self.time = 0


	def onStep(self):
		self.time += 1
		if self.time%70 >= 10:
			self.angle += 1


	def onDraw(self, canvas):
		for person in self.people:		
			person.draw(canvas, self.angle)
		if self.angle%60 == 0:
			if (self.angle/60)%6 == 1:
				canvas.create_text(275, 50, text="Matrices and Linear Algebra", fill="black", font="Helvetica 26 bold underline")
			if (self.angle/60)%6 == 2:
				canvas.create_text(275, 50, text="Concepts of Mathmatics", fill="black", font="Helvetica 26 bold underline")
			if (self.angle/60)%6 == 3:
				canvas.create_text(275, 50, text="Calculation 1", fill="black", font="Helvetica 26 bold underline")
			if (self.angle/60)%6 == 4:
				canvas.create_text(275, 50, text="Calculation 2", fill="black", font="Helvetica 26 bold underline")
			if (self.angle/60)%6 == 5:
				canvas.create_text(275, 50, text="Calculation 3D", fill="black", font="Helvetica 26 bold underline")
			if (self.angle/60)%6 == 0:
				canvas.create_text(275, 50, text="Diffential Equition", fill="black", font="Helvetica 26 bold underline")
			canvas.create_text(275, 80, text="(top sectionof the pie)", fill="black", font="Helvetica 20 bold underline")




movingLineAnimation(width=550, height=550).run()
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0