Logo Search packages:      
Sourcecode: ocempgui version File versions  Download package

def themes::default::DefaultEngine::DefaultEngine::draw_arrow (   self,
  surface,
  arrowtype,
  state,
  cls = None,
  style = None 
)

D.draw_arrow (...) -> None

Draws an arrow on a surface.

Draws an arrow with on a surface using the passed arrowtype as
arrow direction. The method uses a third of the surface width
(or height for ARROW_TOP/ARROW_DOWN) as arrow width and places
it on the center of the surface. It also uses the 'fgcolor'
style entry as arrow color.

If no style is passed, the method will try to retrieve a style
using the get_style() method.

Raises a ValueError, if the passed arrowtype argument is not a
value of the ARROW_TYPES tuple.

Definition at line 319 of file DefaultEngine.py.

00319                                                                           :
        """D.draw_arrow (...) -> None

        Draws an arrow on a surface.
        
        Draws an arrow with on a surface using the passed arrowtype as
        arrow direction. The method uses a third of the surface width
        (or height for ARROW_TOP/ARROW_DOWN) as arrow width and places
        it on the center of the surface. It also uses the 'fgcolor'
        style entry as arrow color.

        If no style is passed, the method will try to retrieve a style
        using the get_style() method.
        
        Raises a ValueError, if the passed arrowtype argument is not a
        value of the ARROW_TYPES tuple.
        """
        if arrowtype not in ARROW_TYPES:
            raise TypeError ("arrowtype must be a value of ARROW_TYPES")
        
        if not style:
            style = self.style.get_style (cls)

        color = self.style.get_style_entry (cls, style, "fgcolor", state)
        rect = surface.get_rect ()
        array = pygame.surfarray.array3d (surface)

        if arrowtype in (ARROW_LEFT, ARROW_RIGHT):
            arrow_width = rect.width / 3
            center = rect.centery
            if center % 2 == 0:
                center -= 1
            if arrowtype == ARROW_LEFT:
                for i in xrange (arrow_width):
                    col = arrow_width + i
                    array[col:col + arrow_width - i:1, center + i] = color
                    array[col:col + arrow_width - i:1, center - i] = color
            elif arrowtype == ARROW_RIGHT:
                for i in xrange (arrow_width):
                    col = rect.width - arrow_width - i - 1
                    array[col:col - arrow_width + i:-1, center + i] = color
                    array[col:col - arrow_width + i:-1, center - i] = color

        elif arrowtype in (ARROW_UP, ARROW_DOWN):
            arrow_height = rect.height / 3
            center = rect.centerx
            if center % 2 == 0:
                center -= 1

            if arrowtype == ARROW_UP:
                for i in xrange (arrow_height):
                    row = arrow_height + i
                    array[center + i, row:row + arrow_height - i:1] = color
                    array[center - i, row:row + arrow_height - i:1] = color
            elif arrowtype == ARROW_DOWN:
                for i in xrange (arrow_height):
                    row = rect.height - arrow_height - i - 1
                    array[center + i, row:row - arrow_height + i:-1] = color
                    array[center - i, row:row - arrow_height + i:-1] = color
        
        # Blit the new surface.
        pygame.surfarray.blit_array (surface, array)
    
    def draw_check (self, surface, rect, checked, state, cls=None, style=None):


Generated by  Doxygen 1.6.0   Back to index