Free scientific and engineering development software
English

Shakespeare

Français

Molière






Thanks for your support



Where to begin? - IDLE - IPython - Eclipse and Pydev - Eclipse and CDT (C/C++ Development Toolkit) - Eclipse and Qt

Getting started with Python(x,y)

Where to begin?

As a beginner, if I could buy only two books on Python, I would buy these two (and, if I could buy only one, it would certainly be the second one because it has a very well written introduction on Python language):

However, if you are interested in a scientific-oriented complete reference with a lot of examples, I would strongly recommend this one:

Complete references of the books mentioned above are listed in the Python(x,y) bibliography.

Of course, it is possible to learn Python without buying anything: Python(x,y) includes almost all freely available documentations, online books, examples and tutorials that I could gather on the internet (please do not hesitate to contact me if you wish to include your own findings).

IDLE

For your first lines in Python, you won’t need any sophisticated IDE. IDLE (Figure 2), that is the Python IDE written by Python creator himself (Guido van Rossum), is powerful enough to edit and run short scripts. It also provides a Python interpreter to run interactively your code (Figure 3).


Figure 2: IDLE editor window



Figure 3: IDLE shell window

To begin with, you may run and then edit matplotlib examples in Python(x,y) documentation (Libraries\matplotlib\examples).

IPython

For rapid prototyping, one can test simple commands or run scripts interactively using the powerful features of IPython (Figure 4), an enhanced Python shell in which – for example – matplotlib features can be used with a syntax which is very close to MATLAB’s.


Figure 4: Python(x,y) interactive console (IPython with Console 2.0)

IPython with matplotlib and Scipy support can be executed from its start menu entry (“Python-Matplotlib console”) or from any file folder by right-clicking on it (“Open Python console here…”), see Figure 5.


Figure 5: Python console integration in Windows Explorer

Learn more on this topics in Python(x,y) documentation : “Using matplotlib interactively” (Library\matplotlib).

Eclipse and Pydev

When it comes to more than one script, and even more for big applications, it is highly recommended to use an IDE which is able to manage development projects. Eclipse is a popular IDE (Figure 6), for which many plugins are available online.
Python(x,y) is distributed with three plugins (preinstalled and mostly preconfigured) :

  1. Pydev : Python language support (with code completion, debugger, etc.) ;
  2. Wicked shell : powerful Windows command shell within Eclipse ;
  3. Qt Eclipse integration: design PyQt GUI within Eclipse.

To get started with Eclipse and Pydev, you may follow the simple steps described from Figure 6 to Figure 12.


Figure 6: Eclipse: create a new Pydev project



Figure 7: Eclipse: configure your project



Figure 8: Eclipse: create a new Pydev module



Figure 9: Eclipse: configure your module



Figure 10: Eclipse: write your first line of code !



Figure 11: Eclipse: save your module before launching



Figure 12: Eclipse: enjoy the show!

Eclipse and CDT (C/C++ Development Toolkit)

Since 1.0.6 release, C and C++ compilers (MinGW) are included in Python(x,y). So you can now develop in C or C++ within Eclipse (the C/C++ Eclipse plugin was already included).

If you need some help to build and run your first C/C++ project with Eclipse, you may found answers in the following screenshots (from Figure 13 to Figure 21).


Figure 13: Eclipse/CDT: create new project



Figure 14: Eclipse: Eclipse/CDT: select C++ project, for example



Figure 15: Eclipse: Eclipse/CDT: name your project and select “Executable”



Figure 16: Eclipse: Eclipse/CDT: open C/C++ perspective



Figure 17: Eclipse: Eclipse/CDT: create new source file



Figure 18: Eclipse: Eclipse/CDT: name your source file



Figure 19: Eclipse: Eclipse/CDT: write your C++ code lines



Figure 20: Eclipse: Eclipse/CDT: build your project



Figure 21: Eclipse: Eclipse/CDT: run your project, that’s all it takes !

Eclipse and Qt

In 2007, Trolltech has released the Qt C++ Eclipse Integration plug-in. This plug-in was originally designed for C++, but the following features can be very useful to Python users:

  • “File, New…” dialog box (Figure 22):
    • Qt Resource File (see Mark Summerfield’s book for further details on .qrc files) ;
    • Qt Designer Form : Qt GUI design tool, the main feature of Qt Eclipse Integration ;
  • “Window, Show view, Other…” dialog box: (Figure 23)
    • Action Editor ;
    • Object Inspector ;
    • Property Editor ;
    • Signal Slot Editor ;
    • Widget Box.

"Eclipse - Qt" folder of the Screenshots section show Qt Eclipse Integration in action.



Figure 22: Eclipse/Qt: Qt Projects within Eclipse



Figure 23: Eclipse/Qt: Qt Design Tools