def draw(self,vacuumArray,levels,limits=False) : # produce standard three frame graphic self.canvas.delete(ALL) dim = levels.shape minVal = amin(levels) maxVal = amax(levels) if(limits) : minVal = limits[0] maxVal = limits[1] color = FalseColor(minVal,maxVal) for i in range(dim[0]): for j in range(dim[1]) : self.canvas.create_rectangle(200*i/dim[0],200*j/dim[1], 200*(i+1)/dim[0],200*(j+1)/dim[1], fill=color.calcColor(levels[i,j])) which = 0 for vacuum in vacuumArray : which += 1 coords = vacuum.getPosition() self.canvas.create_text(100/dim[0]+200*(coords[0])/dim[0], 100/dim[1]+200*(coords[1])/dim[1], text="V"+str(which), justify=CENTER)
def makeLegend(self,lower,upper) : # Routine to show the color scale and associated values that # are displayed in the world views. # Delete the current view and define the colors to be displayed. self.legend.delete(ALL) color = FalseColor(lower,upper) for scale in range(255) : # For each color go through and create a sliver of a # rectangle with the given color. self.legend.create_rectangle(65,200*scale/255, 80,200*(scale+1)/255.0, fill=color.calcColor(upper-float(scale)/255.0*(upper-lower)), outline="") # Display the values for the min, max, and middle values. self.legend.create_text(30,190,text="{0:8.1E}".format(lower),justify=LEFT) self.legend.create_text(30,100,text="{0:8.1E}".format((upper+lower)*0.5),justify=LEFT) self.legend.create_text(30, 10,text="{0:8.1E}".format(upper),justify=LEFT)