User Guide

153
Working with Folders
The os module also includes many functions for creating and
working with folders. Here are some of the ones you will use
often:
6.9 Graphical User Interfaces (GUIs)
Although all of the examples in this chapter have assumed that
you are running Python programs from the Python Shell or the
Linux terminal, it is possible to build full GUIs in Python. To do
this, you need to use a GUI toolkit (or “framework”) that supports
all of the different types of controls that you need – windows,
textboxes, and buttons, for example.
To create a Python program with a GUI that also runs on other
operating systems, you have to use a framework that is available
on all of the machines on which you want to run your program.
A full list of cross-platform GUI toolkits is available at http://
wiki.python.org/moin/GuiProgramming. Of these, the TkInter
framework is particularly popular and is already installed on
Raspbian.
Function Description
mkdir(path) Creates a new folder at the specified path.
makedirs(path) Creates a new folder at the specified path, and
any folders above it that do not exist yet.
listdir(path) Returns a “list” of the contents of the specified
folder.
removedirs(path) Removes (deletes) the specified folder and
everything inside it.
rename(path, path) Changes the name of a folder.