

def drawline(self, start_pos, end_pos, char=' ', fgcolor=None, bgcolor=None):
    if (fgcolor is None):
        fgcolor = self._fgcolor
    else:
        fgcolor = getpygamecolor(fgcolor)
    if (bgcolor is None):
        bgcolor = self._bgcolor
    else:
        bgcolor = getpygamecolor(bgcolor)
    (x0, y0) = start_pos
    (x1, y1) = end_pos
    isSteep = (abs((y1 - y0)) > abs((x1 - x0)))
    if isSteep:
        (x0, y0) = (y0, x0)
        (x1, y1) = (y1, x1)
    if (x0 > x1):
        (x0, x1) = (x1, x0)
        (y0, y1) = (y1, y0)
    if (y0 < y1):
        ystep = 1
    else:
        ystep = (- 1)
    xdelta = (x1 - x0)
    ydelta = abs((y1 - y0))
    error = ((- xdelta) / 2)
    y = y0
    for x in range(x0, (x1 + 1)):
        if isSteep:
            self.putchar(char, y, x, fgcolor, bgcolor)
        else:
            self.putchar(char, x, y, fgcolor, bgcolor)
        error = (error + ydelta)
        if (error > 0):
            y = (y + ystep)
            error = (error - xdelta)

dataset/ETHPy150Open asweigart/pygcurse/pygcurse/__init__.py PygcurseSurface.drawline/original