Find information about a specific Python topic

A place where you can post Python-related tutorials you made yourself, or links to tutorials made by others.

Find information about a specific Python topic

Postby octopez » Wed Feb 13, 2013 12:35 pm

Over the years, the Python community has written and gathered a lot of useful information. It is out there! However, sometimes it is not easy to find your way to the right information.

The following text shall help you finding what you're looking for.

Please note: as a lot of links in a single topic are problematic (forum software may consider it as spam), I'll often write just plain text and no URLs. This may seem complicated to you but a the same time it's a good exercise in using search engines.

General information
Downloads can of course be found on Python's official website http://python.org
If you're using Linux or BSD as your operation system, you'd better use your package manager to install Python unless you have a specific reason not to do so.

Which Python version should I download/install?

If you're not told to use a specific Python version by someone (teacher, supervisor, dev-team), you have to choose for yourself.
I'll focus on the official version from Python.org here, also known as CPython.
Note that there are also other implementations of Python, written in other programming languages or for different purposes, such as Jython (Python for the Java Runtime), IronPython (Python for the .NET Framework). If you have to use something other than "normal Python" (CPython because it's written in C), you would know.
Let's get back to official Python:
Currently there are two offical Python versions available: the Python 2 branch and the Python 3 branch. With the step from 2 to 3 the Python inventor Guido van Rossum aka BDFL wanted to make some changes to the design of Python. This makes some code written in Python 2 not to work anymore. A lot of 3rd party libraries (called modules in Python) do not work anymore and have to be rewritten. This takes time, but a lot of modules are already translated and work on both versions of Python. Also a bunch of tutorials are not translated yet, or will never get translated. This is NOT true for the official Python docs on Python's website. They are always up to date and availiable for both branches.
Personally I'm still working with the Python 2.7.x branch, as I'm dependant of some 3rd party modules at work.

Where can I find tutorials and other informations about?
There's a gazillion tutorials for Python out there, but some are outdated. The following list contains just a few websites I visit on a regular basis, but I don't clain that it's complete.
A good start could be Zed Shaw's website: http://programming-motherfucker.com/become.html#Python
His section already links to "Dive into Python" and "A Byte of Python" and some other freely available Python books.
He's also written "Learn Python the Hard way". Check it out at http://learnpythonthehardway.org/book/

If you want to write programs with GUIs (Graphical User Interfaces, such as Windows, Buttons, Lists, Checkboxes, ...) you might have a look at
http://zetcode.com
There you can find a lot of useful tutorials for all common GUI toolkits.

Wait! Common GUI toolkits? There is more than one? What the ....
Yes. Unlike other programming languages such as Delphi, Visual Basic, C#, ... Python gives you the freedom to choose the best tools for your task. This also means, that you have to know what's available. It may seem confusing, but it's not that hard. You just have to show a little patience.
But to make a long story short: there are 4 big toolkits, you should have heard of:
  • Tkinter (comes automatically with Python on Windows), crossplatform: some say it's ugly (since 8.5 it's better and has more widgets!!!), but for starting out and for small tasks I really like it. Runs on Python 2 and 3.
    Helpful links:
    http://effbot.org/tkinterbook/
    http://tkdocs.com/tutorial/index.html
    http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html
    http://zetcode.com/gui/tkinter/
  • wxPython, crossplatform: quite popular. Uses the native GUI on each platform (WinAPI on Windows, Carbon on MacOSX and GTK on Linux/BSD). Therfore the GUI looks native on every platform. Some say it's API is 'unpythonic', but once you're used to it, it's ok to work with. However, I'm not sure what the status of wxPython on Python 3 is. wxPython has a 'tool' called 'wxPython Docs and Demos' which is powerful resource to learn from! Also, there are at least 2 books (wxPython in Action and wxPython Cookbook). The google user group is very active and the members are very helpful.
    http://zetcode.com/wxpython/
    http://wxPython.org
    http://blog.pythonlibrary.org/tag/wxpython/
  • PyQt and PySide, crossplatform: PyQt and PySide are both wrapper modules for the popular and powerful Qt lib, which is written in C++. It's not native on any platform (despite Linux/BSD, where KDE is a one of the most used desktops around and therefore native). This means: it mimics the look & feel of Windows on Windows and of Mac on Mac. It's available for Python 2 and 3 and has a lot to offer! For years only PyQt was available as wrapper for Qt and both the licenses of PyQt and Qt made it a little "unattractive". But this seems to have changed and PySide has not such a restrictive license, I guess.
    As I'm not very familar with PyQt/PySide, I can't write that much about it, but maybe someone else can complete this?
    Resources:
    http://qt-project.org/wiki/PySide
    http://zetcode.com/gui/pysidetutorial/
  • PyGTK, crossplatform: Python binding for GTK (Gimp Tool Kit). As the name already says: it's the same GUI that the GIMP uses. It's used for the GNOME and XFCE desktops. A lot of popular programs have GTK as GUI. It's only native on Linux and looks just a little odd on Windows (though I don't mind as I love GIMP and Inkscape), but rumors have it, that a lot of Mac users just can't cope with it (= don't like it). Also it seems quite hard to install on Apple computers (not the installation of PyGtk, but to get GTK running).
    http://pygtk.org
    http://zetcode.com/gui/pygtk/

What else should I know?
Most of the tutorials explain it anyways, but you might want to have a decent editor, that is capable of Python.
Commonly used are: Scite, Notepad++, Textmate, Gedit, Kate, Spyder, Eric, SPE, Vim, Emacs, IDLE ...

You might have heard, that Python can be used to write games. If you want to write computer games in Python you will stumble upon Pygame. Pygame is not the only one, but the most known and most popular. Pygame is a cross platform module based on SDL. You can visit pygame.org for information and download. If you're running MS Windows, make sure that you download the correct Pygame version that fits your Python version.
E.g.: if you're running Python 2.7, 32bit make sure that you download pygame-1.9.1.win32-py2.7.msi. See? py2.7 for Python 2.7 and win32 for 32bit Python version. Easy.

I'm bored and don't know which program to write!
Go to http://pythonchallenge.com/ and try it out. You'll learn a lot!
You also can visit http://projecteuler.net/, it's not Python centric, but offers a lot of tricky programming tasks (related to mathematics).

Anything else?
Python is an interpreted programming language, which means there is no compiler that translates your incode into binary machine code. However you can use py2exe or cz_freeze to pack your code with the necessary Python interpreter + modules into a separate "stand alone program".

Oh, I'm sure, there is more information! There is stackoverflow, which has a billion Python related questions, there's ActiveState's archive with Python related stuff. There are some Python related Podcasts out there.


And last but not least there is US - the memebers of http://python-forum.org.
If you get stuck, just ask and we'll try to help you!


P.S.: everyone is invited to add information here. :)
Last edited by stranac on Wed Feb 13, 2013 1:57 pm, edited 2 times in total.
Reason: Made all the links into actual links(cause I can)
Greetings and all the best,
Octopez

Strange women lying in ponds distributing swords is no basis for a system of government.
User avatar
octopez
 
Posts: 25
Joined: Fri Feb 08, 2013 11:26 pm

Return to Tutorials

Who is online

Users browsing this forum: Google [Bot] and 2 guests