Tumgik
#pythonidle
pc-eight-four · 2 years
Text
False IDLE(s): Python's built in text editor is the ONE!
When I started to learn Python, I was working my way through a text book and an overwhelming supply of YouTube tutorials to try my hand at being a digital wizard. Now I won't be covering the fabled 'Tutorial Hell' that many of us who are self taught get trapped in, screaming for relief, surrounded by piles of abandoned code taunting us from every side. What I want to share was the never ending saga of code editor/environments pushed on you from all sides, also known as IDE's. Here's a snippet from CodeAcademy defining an IDE:
Tumblr media
Sounds pretty cool right? That's because it is! It seemed like every tutorial I read preferred on over another. 'Learn Python 3 the Hard Way' by Zed Shaw had me start out with ATOM text editor (goodnight sweet prince), it was simple, but to my newbie brain, full of settings i was sure I'd never understand. Then a few tutorials pointed out the amazing features and capabilities of PyCharm so I downloaded a free community edition right away! So sleek and flashy with cool highlighting, but what were all these weird files and directories showing up around my helloworld.py file? I was already up to my ears in esoteric ideas and syntax, no one said anything about surprise files and directories! All this AND the resources this program were using up was making for slow loading and I could hear my poor little laptop begging for mercy. VsCode was more aesthetically pleasing for me, and supported multiple languages but -there's those damn funky files again!
Tumblr media
There were some editors I found that were minimal , but they all had little things that bothered me or did something for me that I wanted to understand before handing over control to the automation gods!
As beginners we're at our most susceptible to marketing manipulation and advertising. The waves of information are hitting us from every side and everyone is offering safe harbor in their particular product and solution. It's the paralysis of choice! But fear not, because the Zen of Python can guide us here, reaching out through the darkness like the beam of a lighthouse:
SIMPLE IS BETTER THAN COMPLEX
Tumblr media
Just for the sake of this tutorial imagine that as soon as I read the Zen of Python, clouds parted and a serpent delivered a message, whispering in my ear "Look into the language for your answers".
Tumblr media
To my surprise, Python has an editor bundled into it BY DEFAULT that's simply called IDLE (Integrated Development Learning Environment) and if you are coding with Python, then you already have it at your fingertips!
But how easy is it to access?
How To: Python IDLE
In Mac or Linux, open a terminal by either searching for 'terminal' or often times CTRL + T will launch it automaticlally. Once you find it you should be looking at something like this:
Tumblr media
The little blinking block is waiting for you. Type all lowercase idle and hit Enter.
Tumblr media
For Windows you should have some menu shortcuts like these:
Tumblr media
Type, Click and that's it! You have just launched Python's very own text editor and development environment!
Tumblr media
You might wonder where the familiar text editor is since the window clearly says IDLE Shell at the top. The Python Shell aka REPL (Read Evaluate Print Loop) is an important tool and has it's uses, but I find myself most often opening IDLE for the text editor.
We can get to the text editor by finding the File drop-down and selecting New File. Alternately the keyboard shortcut is Ctrl + N
Tumblr media
Voila! A blank canvas!
Tumblr media
Let's enable the numbered lines that we're used to seeing by selecting the Options drop-down and choosing Show Line Numbers
Tumblr media
Enter a Hello World program .....
Tumblr media
Before running the program we want to save. Navigate to the File drop-down and selectSave File or CTRL + S
Tumblr media
Once the program is saved, navigate to the Run drop-down menu, selecting Run Module to run the program. Once again you could just hit the F5 key to bring economy to your movements (if you forgot to save, IDLE will remind you before allowing you to continue)
Tumblr media Tumblr media
Looks like Mr. Worldwide has entered the chat!
Everything is working as it should! If you are coding along with this you may be wondering two things. Why is your editor so painfully WHITE (Bright light! Bright light!), while these examples are relaxing you with their cobalt blue. Why does your IDLE still launch into the Shel when opening?
Tumblr media
Like everything else so far, this is an easy fix.
Dip into that Options drop-down menu and select Configure IDLE. This brings you into the Settings menu where we change font size and face (I've tried a bunch of fonts, none seem to be as clear and pleasing as the default) and make many of the configuration changes to make our hearts sing.
Tumblr media
Let's take care of the 'Theme' first so our eyes can be awash in the deep blue of this little tutorial. Switch from Fonts/Tabs to Windows .
Tumblr media
The option you're looking for is right at the top. Select Open Edit Window
Tumblr media
Click Apply and your settings will be saved.
To get our initial configurations aligned to our delicate sensibilities, Switch from Windows to Highlights. Now to the right ( your right), click the drop-down menu and select IDLE Dark. Ahhhhhh...
Your eyes are already relaxing after searching for the perfect simple IDE for Python for so long.
Tumblr media
Click the Apply button after you make any changes and you are ready to code, leaving a little bit of the worry and complexities noobs are pounded with on our journey to high digital sorcery.
There will be a time in our growth as Python programmers when we will be ready for all the virtual environments, automated package importers and GIT integrations you can shake a stick at. In the mean time, IDLE is a perfect middle ground that is reliable, simple and is even written in the very language we are learning!
Every text editor and IDE has it's audience and it's place. You my find that Pycharm , Vims, VsCode or even Emacs is a perfect fit for your Python development and to you I say hurrah! What's important is that we find tools that feel comfortable for each of us and let us focus on learning and building rather than fumbling around endlessly with the tool itself.
Hopefully you find IDLE is a hidden gem of an IDE that serves you well in your learning journey.
One last thing weary traveler.....
Tumblr media
Happy Coding!
9 notes · View notes
fullcircletechuk · 3 years
Photo
Tumblr media
#FullcircleTechUK #cs #coding #programming #lycée #education #highschool #secondaryschool #ifelse #selection #python #PythonIdle #pythonprogramming #pythonIfstatement #anyonecancode #pythonexample #selection #instagram (at UK) https://www.instagram.com/p/CSD8QQ-CqHA/?utm_medium=tumblr
0 notes