Python Forum
IDLE indenting 29 columns after defining function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IDLE indenting 29 columns after defining function
#1
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
Reply
#2
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Conjugate Gradient having issues with defining A (function to solve [A]{x} = {b} ) DimosG 2 2,821 Sep-21-2021, 08:32 PM
Last Post: 1968Edwards
  Defining a function with input abcd 5 3,101 Feb-21-2021, 02:34 AM
Last Post: NullAdmin
  don't know indenting of break and continue Colin999 5 2,137 Sep-18-2020, 09:20 AM
Last Post: perfringo
  Sublime Text + Anaconda not indenting Python code correctly Maxximiliann 0 1,983 Jun-13-2020, 06:09 PM
Last Post: Maxximiliann
  When Defining a Function with an Equation as a Default Argument, which Value Is Used? OJGeorge4 4 2,653 Apr-09-2020, 08:48 AM
Last Post: DeaD_EyE
  5 python columns, row-wise as input to a function dervast 1 2,019 Jul-17-2019, 08:53 PM
Last Post: Larz60+
  Problem with defining a function snow_y 4 3,197 Nov-26-2018, 02:13 AM
Last Post: snippsat
  IDLE not importing pygame (ok outside of IDLE) miner_tom 1 3,316 Sep-14-2018, 07:54 PM
Last Post: Larz60+
  Defining a Function mattt1998 4 3,409 Dec-14-2017, 07:02 AM
Last Post: buran
  Defining an fsolve function to call later hegdep 1 3,073 Oct-25-2017, 07:38 AM
Last Post: hegdep

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020