Python Forum

Full Version: IDLE indenting 29 columns after defining function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In the program I'm working on, the IDLE keeps indenting by 29 columns instead of 4 after defining a function. I'm not sure why and I'd appreciate some help fixing this!

def drawIcon(shape, color, boxx, boxy):
    quarter = int(BOXSIZE * 0.25)
    half = int(BOXSIZE * 0.5)

    left, top = leftTopCoordsOfBox(boxx, boxy)

    if shape == DONUT:
        pygame.draw.circle(DISPLAYSURF, color, (left + half, top + half), quarter - 5)

    elif shape == SQUARE:
        pygame.draw.rect(DISPLAYSURF, color, (left + quarter, top + quarter, BOXSIZE - half, BOXSIZE - half))
    elif shape == DIAMOND:
        pygame.drawpolygon(DISPLAYSURF, color, ((left + half, top), (left + BOXSIZE - 1, top + half), (left + half, top + BOXSIZE - 1), (left, top + half)))
    elif shape == LINES:
        for i in range(0, BOXSIZE, 4):
            pygame.draw.line(DISPLAYSURF, color, (left, top + i), (left + i, top))
            pygame.draw.line(DISPLAYSURF, color, (left + i, top + BOXSIZE - (left + BOXSIZE - 1, top + i))
    elif shape == OVAL:
        pygame.draw.elipse(DISPLAYSURF, color, (left, top + quarter, BOXSIZE, half))

def getShapeAndColor(board, boxx, boxy):
                             #place it indents to
IDLE is a poor excuse for an IDE. I wish they would stop packaging it with python, or at least fix problems.
You should choose another IDE. Top two seem to be VS Code: https://code.visualstudio.com/#meet-intellisense
and PyCharm (community edition): https://www.jetbrains.com/pycharm/downlo...on=windows
There are many others: Goofle: 'Python IDE's'

As this is a personal as well as professional choice, It's good to try several until you find one that fits your style