groupedfield
groupedfield.py — Python Source, 4 KB (5047 bytes)
Dateiinhalt
#author: Mario G. #date: 25.03.2013 #version: 1.0 #name: groupedfield from visual import * class standartfield(frame): def __init__(self, col=color.white, position=(0,0,0), visible=true): frame.__init__(self) self.field=box(frame=self, pos= position, length=2, width=2, height=0.03, color=col) #mention=label(pos=(0,0,0),text='Start') class groupedfield (frame): def __init__(self, farbeGround= color.magenta, farbeSpezial=color.red, farbePyramide=color.green, groupedfieldPosition=(0,0,0)): frame.__init__(self) #self.ground= box(pos=(0,0,10), length= 80, width= 80, height= 0.1, color= farbeGround, frame= self) self.feld1= standartfield(position=(8,1,0),col=farbeGround) self.feld2= standartfield(position=(13,2, 0),col=farbeGround) self.feld3= standartfield(position=(18,3, 0),col=farbeGround) self.feld4= standartfield(position=(23,4,0),col=farbeGround) self.feld5= standartfield(position=(23,3,5),col=farbeGround) self.feld6= standartfield(position=(23,2,10),col=farbeGround) self.feld7= standartfield(position=(23,1,15),col=farbeGround) self.feld8= standartfield(position=(23,2,20),col=farbeGround) self.feld9= standartfield(position=(23,3,25),col=farbeGround) self.feld10= standartfield(position=(23,4,30),col=farbeGround) self.feld11= standartfield(position=(18,3,30),col=farbeGround) self.feld12= standartfield(position=(13,2,30),col=farbeGround) self.feld13= standartfield(position=(8,1,30),col=farbeGround) self.feld14= standartfield(position=(3,2,30),col=farbeGround) self.feld15= standartfield(position=(-2,3,30),col=farbeGround) self.feld16= standartfield(position=(-7,4,30),col=farbeGround) self.feld17= standartfield(position=(-7,3,25),col=farbeGround) self.feld18= standartfield(position=(-7,2,20),col=farbeGround) self.feld19= standartfield(position=(-7,1,15),col=farbeGround) self.feld20= standartfield(position=(-7,2,10),col=farbeGround) self.feld21= standartfield(position=(-7,3,5),col=farbeGround) self.feld22= standartfield(position=(-7,4,0),col=farbeGround) self.feld23= standartfield(position=(-2,3,0),col=farbeGround) self.feld24= standartfield(position=(3,2,0),col=farbeGround) # self.feldA= standartfield(position=(8,1,-5),col=farbeGround) self.feldB= standartfield(position=(28,1,15),col=farbeGround) self.feldC= standartfield(position=(8,1,35),col=farbeGround) self.feldD= standartfield(position=(-12,1,15),col=farbeGround) self.feldAA= standartfield(position=(8,1,-10),col=farbeGround) self.feldBB= standartfield(position=(33,1,15),col=farbeGround) self.feldCC= standartfield(position=(8,1,40),col=farbeGround) self.feldDD= standartfield(position=(-17,1,15),col=farbeGround) # self.feldAv= standartfield(position=(8,2,5),col=farbeSpezial, visible=False) self.feldAAv= standartfield(position=(8,3,10),col=farbeSpezial, visible=False) self.feldBv= standartfield(position=(18,2,15),col=farbeSpezial, visible=False) self.feldBBv= standartfield(position=(13,3,15),col=farbeSpezial, visible=False) self.feldCv= standartfield(position=(8,2,25),col=farbeSpezial, visible=False) self.feldCCv= standartfield(position=(8,3,20),col=farbeSpezial, visible=False) self.feldDv= standartfield(position=(-2,2,15),col=farbeSpezial, visible=False) self.feldDDv= standartfield(position=(3,3,15),col=farbeSpezial, visible=False) self.feldE= standartfield(position=(8,4,15), col=farbeSpezial, visible=False) # self.deko1= pyramid(pos=(8,4,15), size=(5,5,5), axis=(0,-1,0), color=farbePyramide, visible= True, material=materials.chrome) self.deko2= pyramid(pos=(8,4,15), size=(5,5,5), axis=(0,1,0), color=farbePyramide, visible= True, material=materials.chrome) def special(self, sichtbar): if sichtbar==True: self.feldAv.visible=True self.feldAAv.visible=True self.feldBv.visible= True self.feldBBv.visible=True self.feldCv.visible= True self.feldCCv.visible= True self.feldDv.visible= True self.feldDDv.visible= True self.feldE.visible= True self.deko2.visible= False else: self.feldAv.visible=False self.feldAAv.visible=False self.feldBv.visible= False self.feldBBv.visible=False self.feldCv.visible= False self.feldCCv.visible= False self.feldDv.visible= False self.feldDDv.visible= False self.feldE.visible= False self.deko2.visible= True #for i in range(5): # deko2.pos=(8,4+i, 15) ereignis=False #nutze groupedfield, variiere Koordinaten feldgruppe1= groupedfield() feldgruppe1.special(ereignis)