Saturday, January 23, 2016

Thonny - A Python IDE for Beginners

I received an email a few days back from Aivar Annamaa about a Python IDE for beginners called Thonny.

The YouTube video introducing the IDE looks promising, so I am jumping at the opportunity to take a look at it.

Thonny is in the Python Package Index, so it can be easily installed (and installed by user without system admin privileges) using pip.  In a previous post I documented installing Python 3.4, which is required to before what follows.

First I want to get pip3.  Since it is not yet in the main Centos repository, I installed it with (note: run $ sudo -i and then # exit before running this command in the same terminal emulator so as not to be prompted for a sudo password):
$ curl https://bootstrap.pypa.io/get-pip.py | sudo python3.4
I want to install Thonny inside the user's local directory, so I installed it with:
$ pip3 install --user thonny
This installs the thonny egg in $HOME/.local/lib/python3.4/site-packages (creating the needed lib/python3.4/site-package directory if it is not already there), and installs a shell script to launch it in $HOME/.local/bin. When I tried running thonny from the command prompt, I got an error message: ImportError: No module named 'tkinter'. So I needed to install tkinter:
$ sudo yum install python34-tkinter
after which thonny launched.  It complained that it couldn't find rope or jedi, however, so I installed those locally as well:
$ pip3 install --user rope
$ pip3 install --user jedi
Since thonny is a GUI IDE, I wanted a GUI launcher for it.  To get one I created a Thonny.desktop file based on the one I found here, with the following contents:
[Desktop Entry]
Type=Application
Name=Thonny
GenericName=Python IDE
Exec=/home/[username]/.local/bin/thonny %F
Comment=Python IDE for beginners
Icon=/home/[username]/.local/lib/python3.4/site-packages/thonny/res/thonny.ico
Terminal=false
Categories=Application;Education;Development;Debugger;IDE;
MimeType=text/x-python;
Actions=Edit;

[Desktop Action Edit]
Exec=/home/[username]/.local/bin/thonny %F
Name=Edit with Thonny
and placed it in my /home/[username]/.local/applications directory (Note: replace [username] with your actual username).

Here is a screenshot of Thonny running hello.py:
My next task will be to go through some beginner Python lessons using Thonny to see how it feels.

16 comments:

  1. Is there some development with Spyder?

    ReplyDelete
  2. If this is an IDE for beginners, why are the instructions to install Thonny not for beginners? I have no clue how to install Thonny the way you describe.

    ReplyDelete
    Replies
    1. Sorry, it is the instructions to install Pip3 that I don't understand.

      Delete
  3. There are easy to use installers as well (at least they are easy for Windows and MacOS), with links off the Thonny home page:

    http://thonny.org/

    ReplyDelete
  4. Newer versions of python come with pip installed and setup with environment variables out of the box. I installed thonny using pip from the command prompt in Windows 10 with python 3.6

    ReplyDelete
  5. I am a new in python .so i want help from beginning beside my English is not very well

    ReplyDelete
  6. Thanks for sharing nice information with us. i like your post and all you share with us is uptodate and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job.   site

    ReplyDelete
  7. totally foxed by your jargon. I am an HND COMPUTER SCIENCE PERSON. nONE OF YOU HAVE GIVEN INSTRUCTIONS TO NINSTALL pYTHGON 2 IDE

    ReplyDelete
  8. How can I find and replace in Thonny in a SELECTION of the program ie just among certain group of lines?

    ReplyDelete
  9. Je suis nouveau dans la programmation de python je besoin d'aide pour mieux comprendre la programmation. j'ai 15 an, dans 2 an je veux ĂȘtre Un grand programmeur de Site web .

    ReplyDelete
  10. I am also new to Python.
    In the past I have been put off by the (to me) arcane command line entries needed to set everything up.
    But I went to the Thonny website downloaded the windows package and it, I could start programming with the minimum of fuss.
    Excellent.. Thank you!!!

    ReplyDelete
  11. pls am on eable to execute on my python, why

    ReplyDelete
  12. what about wing ide? is that better than thonny?

    ReplyDelete