User:Rmyers/IDLE on the XO

From OLPC
< User:Rmyers
Revision as of 00:42, 21 July 2008 by Rmyers (talk | contribs) (typos)
Jump to navigation Jump to search

IDLE is the default IDE for Python. The XO has a very limited Python viewer and editor Pippy. There is a more advanced environment Develop under development.

I decided to try to get the IDLE environment working on the XO. I wanted an XO based Python IDE that I could use to show Python code, and which would allow intermediate level development directly on the XO. As Develop matures this will probably no longer be necessary.

IDLE is inherently a multi-window application. It has windows open for the Python shell, files that you are editing, and support functions such as class browsers. As such, it is not well suited to use under Sugar, where each window appears as a separate item (with generic round disc icon) on the task circle. It works better in a environment that better supports multi-window applications, such as XFCE. See the Xfce page for installation instructions. There is also an issue with fonts on current production XO builds, which is discussed below.

Warning:

I have successfully installed IDLE on my XO. However this document is a work in progress and may contain errors. This message will be removed when I'm confident in this document's essential accuracy. Hopefully this will be by about 7/25/08.

What's already there

The Python 2.5 distribution that comes on the XO already contains IDLE. The IDLE library is located at /usr/lib/Python2.5/idlelib. The IDLE main module is idle.py.

So in a terminal window you ought to be able to

   cd /usr/lib/python2.5/idlelib
   python idle.py

to fire it up.

This doesn't quite work. You'll get a message that tkinter is missing.

Tkinter

Tk is a platform independent GUI framework.

Tkinter is the Python binding to it. By default this is not installed on the XO.

IDLE requires tkinter for some graphics services.

Tkinter can be installed by doing the following:

   su
   yum install tkinter
   exit

Tkinter should now be installed at /usr/lib/python2.5/lib-tk.

There are some modules of this that can be run from python that will give you an idea what services are provided.

Font issues

IDLE under Sugar

IDLE under XFCE