Some very basic qs about IDLE

Discussion in 'Mac Programming' started by unbelly, Mar 26, 2012.

  1. unbelly macrumors newbie

    Mar 1, 2012
    I've downloaded IDLE as my interpreter for Python and at first thought I had the hang of it but totally confused now.

    I have the IDLE shell open for Python which is what I get when I open IDLE but I have noticed that I can open a new window from the shell and that this brings up a notepad type page, without the prompts. Is this the main text editor page where I have to write the code and where I save it from? What's confusing me is that I also seem to be able to save files from the Shell and I am just wondering why i would want to save in both?

    I realise this is a very basic question but I am new to programming and ignorant about a lot of the basic stuff comp sci people would take for granted!

    The extra problem I'm having is that I have another thing installed - when I open it's a black window with prompts, similar to IDLE shell, and is called python.exe at the top.

    I downloaded these via the MIT site and didn't fully understand the difference of each when I downloaded...

    Would really appreciate any help with which ones I need to use. I'm thinking two would be enough- text editor and shell in IDLE? And that I don't need the python.exe (the black screen window).
  2. thundersteele macrumors 68030

    Oct 19, 2011
    Python can be used interactively, or in a more conventional way of "write code, then execute code."

    IDLE gives you both options, i.e. a python shell with a prompt for interactive work, and a text editor (with highlighting and code completion).

    When you save a file from the shell, this saves the shell history, which does not give a working piece of python code, but can still be useful. I don't know what your python.exe is, but probably you don't need it ;)
  3. unbelly thread starter macrumors newbie

    Mar 1, 2012
    You are right, I don't need that extra python window. I typed some code into the IDLE text editor, had to save it, then pressed run, and it then brought up the shell which showed the results. Perfect.

    Thanks for your help thundersteele!

    I see I can do it all in the shell also and take your point about how the editor is good for saving the code itself.
  4. Bradf0rd91 macrumors newbie

    Mar 27, 2012
    I'm also in a basic (and I mean BASIC) CompSci class at the moment, and I had very similar questions to these that no one ever thinks to answer in class. From what I understand, that black window is (or is a form of) a "terminal"? Someone correct me if I'm wrong here, but that '.exe' extension at the end means it is meant for 'executing' the code you write, and only that. The shell allows you to interactively write and run code (but not save it). The edit window allows you to write and save code (but not run it). The black window is what pops up if you ever select a file you've saved and double-click it (to run it) without telling the computer you want it opened in a shell.

Share This Page