Can I configure IDLE to automatically convert tabs to spaces?
Asked Answered
R

3

6

I know that spaces are preferred over tabs in Python, so is there a way to easily convert tabs to spaces in IDLE or does it automatically do that?

Rohr answered 14/5, 2013 at 15:34 Comment(6)
IDLE isn't much of an IDE.Sanitize
IDLE isn't much of an IDE, AND it already prefers spaces over tabs. Just press your tab key and IDLE will add spaces. I don't think it's even possible to change it to support tabs.Idiocrasy
Did you check? This is trivial to verify.Disraeli
@Sanitize Why do you write that IDLE isn't an IDE ? (or maybe I don't understand the english expression "isn't much of"). See here (docs.python.org/2/library/idle.html): "IDLE is the Python IDE built with the tkinter GUI toolkit."Fabliau
Markus, same interrogation for you (I couldn't put @Markus Meskanen after @Blender)Fabliau
@Fabliau "IDLE isn't much of and IDE." means that IDLE sure is an IDE, but it's not a good one. IDLE barely fulfills the requirements of an IDE and there are so many things that it lacks from a modern IDE.Idiocrasy
L
2

From the IDLE documentation:

Tab inserts 1-4 spaces (in the Python Shell window one tab).

You can also use Edit > Untabify Region to convert tabs to spaces (for instance if you copy/pasted some code into the edit window that uses tabs).


Of course, the best solution is to go download a real IDE. There are plenty of free editors that are much better at being an IDE than IDLE is. By this I mean that they're (IMO) more user-friendly, more customizable, and better at supporting all the things you'd want in a full-featured IDE.

Legendre answered 14/5, 2013 at 16:5 Comment(1)
Downvoted for "get a real IDE". There is a place for IDLE, and better places to start editor wars.Sherman
K
1

Unfortunately IDLE does not have this functionality. I recommend you check out IdleX, which is an improved IDLE with tons of added functionality.

Keelykeen answered 14/5, 2013 at 15:57 Comment(1)
IDLE behaves this way by default (at least in the edit window)... And the command Edit > Untabify Region converts tabs to spaces. What functionality don't you think it has?Legendre
P
1

In IDLE 3.6.5, it's Format > Untabify Region

Pineapple answered 17/5, 2018 at 10:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.