idle an ide for python bundled with the program release click on idle (python gui) in the start menu...

9
IDLE An IDE for Python bundled with the program release Click on IDLE (Python GUI) in the Start menu under the Python program group Get the IDLE Python Shell window, like the Python command line

Upload: thomas-woods

Post on 14-Jan-2016

245 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: IDLE An IDE for Python bundled with the program release Click on IDLE (Python GUI) in the Start menu under the Python program group  Get the IDLE Python

IDLE An IDE for Python bundled with the program release

Click on IDLE (Python GUI) in the Start menu under the Python program group

Get the IDLE Python Shell window, like the Python command line

Page 2: IDLE An IDE for Python bundled with the program release Click on IDLE (Python GUI) in the Start menu under the Python program group  Get the IDLE Python

Under the File menu, click New Window (or Ctrl+N)

Gives a window to compose a new Python file (module)

Page 3: IDLE An IDE for Python bundled with the program release Click on IDLE (Python GUI) in the Start menu under the Python program group  Get the IDLE Python

Type in the new code

Note the color coding

In the Run menu, click Run Module (or F5)

If you didn’t save the file, you get an alert

Click OK, and a save window pops up

Page 4: IDLE An IDE for Python bundled with the program release Click on IDLE (Python GUI) in the Start menu under the Python program group  Get the IDLE Python

Then program output (and input, if any) occurs in the Python Shell

Page 5: IDLE An IDE for Python bundled with the program release Click on IDLE (Python GUI) in the Start menu under the Python program group  Get the IDLE Python

When you start a new IDLE session, to open this file again in a program window,

click Open in the File menu in the Python Shell, and

navigate to this file

Or put the mouse cursor on Recent Files in the File menu, and click on this file in the resulting list of recently accessed files

It's common to write a .py in some editor (e.g., Notepad++) then open and run it in IDLE

Correct errors directly in the IDLE program window

Notepad++ will ask whether you want to update your file to what has been changed in IDLE (You generally do)

Page 6: IDLE An IDE for Python bundled with the program release Click on IDLE (Python GUI) in the Start menu under the Python program group  Get the IDLE Python

In the Windows explorer, if you're in a folder with a .py file, right click on its icon to pop up a menu of operations on it

Click on Edit with IDLE

Opens an IDLE program window with the contents of that file

Clicking Run Module in the Run menu opens IDLE Python Shell window in which the file is execute

Page 7: IDLE An IDE for Python bundled with the program release Click on IDLE (Python GUI) in the Start menu under the Python program group  Get the IDLE Python

Files with just function or class definitions ("modules") don't produce output when they're run

The prompt advances in the IDLE Python Shell (and nothing else)

In the Shell, at the prompt, can now call the functions and classes defined in the file

Running the file has executed the function and class definitions

Page 8: IDLE An IDE for Python bundled with the program release Click on IDLE (Python GUI) in the Start menu under the Python program group  Get the IDLE Python

IDLE locates syntax errors

Suppose we omit the ‘:’ in

while b < n

Selecting Run Module in the Run menu of the program window results in an alert

The error is highlighted in the listing in the program window

Dismiss the alert and provide the missing colon

The highlighting goes away

Page 9: IDLE An IDE for Python bundled with the program release Click on IDLE (Python GUI) in the Start menu under the Python program group  Get the IDLE Python

To reproduce a previous command, type the first character or so (enough so it’s the 1st command starting with that sequence in a search back through the history) then type Alt-p

The up-arrow key doesn’t work for moving back in the history

When you come to the opening ‘(‘ for the argument list of a function (predefined or user-defined), IDLE shows you the signature for that function—e.g.,