Changeset 1078

Show
Ignore:
Timestamp:
10/29/08 16:47:49 (2 months ago)
Author:
bhimebau
Message:

basic visualization working

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • analog/pyeac/branches/pyeac_pygame/visualizer.py

    r1076 r1078  
    1010 
    1111    def __init__(self, fill_color=(100,0,0)): 
     12        self.fill_color = fill_color 
    1213        self.surface = pygame.Surface((500,500)) 
    1314        fill_window = Rect((0,0),(100,100)) 
     
    2627        self.surface.fill(color,fill_window) 
    2728 
     29    def update(self,vdata): 
     30        for y in range(5): 
     31            for x in range(5): 
     32                if self.fill_color[2]==0: 
     33                    cdata = (int((vdata[y][x]/5.0)*255),0,0) 
     34                else: 
     35                    cdata = (0,0,int((vdata[y][x]/5.0)*255))         
     36                self.set_block((x,y),cdata) 
    2837         
    2938__version__ = "0.0.1"