def rectangle(self,
                  rect=None,        # the bounds of the rectangle (left,right,top,bottom)
                  duration=1.0,     # duration for which this object will be displayed
                                    # if this is a string, the stimulus will be displayed until the corresponding event is generated
                                    # if this is a list of [number,string], the stimulus will at least be displayed for <number> seconds, but needs to confirmed with the respective event
                                    # if this is 0, the write will be non-blocking and you have to .destroy() the return value of this function manually  
                  block=True,       # whether this function should only return once the duration is over
                  # additional parameters
                  color=(1,1,1,1),  # the (r,g,b,a) color of the rectangle
                  parent=None,      # the renderer to use for displaying the object
                  depth=0,          # screen depth of the rectangle
                  ):
        """Draw a single-colored rectangle."""
        
        if duration == 0:
            block = False
        
        l=rect[0];r=rect[1];t=rect[2];b=rect[3]
        obj = self._engine.direct.gui.OnscreenImage.OnscreenImage(image='blank.tga',pos=((l+r)/2,depth,(b+t)/2),scale=((r-l)/2,1,(b-t)/2),color=color,parent=parent)
        self._to_destroy.append(obj)
        obj.setTransparency(self._engine.pandac.TransparencyAttrib.MAlpha)
        if self.implicit_markers:
            self.marker(250)
        if block:
            if type(duration) == list or type(duration) == tuple:
                self.sleep(duration[0])
                self.waitfor(duration[1])
            elif type(duration) == str:
                self.waitfor(duration)
            else:
                self.sleep(duration)
            self._destroy_object(obj,251)
        else:
            if duration > 0:                            
                self._engine.base.taskMgr.doMethodLater(duration, self._destroy_object, 'ConvenienceFunctions, remove_rect',extraArgs=[obj,251])
            return obj
dataset/ETHPy150Open sccn/SNAP/src/framework/basicstimuli.py/BasicStimuli.rectangle/original