15.04.2013 Views

Core Python Programming (2nd Edition)

Core Python Programming (2nd Edition)

Core Python Programming (2nd Edition)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Line-by-Line Explanation<br />

Lines 15<br />

These first few lines contain the usual Unix startup line and importation of the os module, the time.sleep<br />

() function, and all attributes of the Tkinter module.<br />

Lines 913<br />

These lines define the constructor for the DirList class, an object that represents our application. The<br />

first Label we create contains the main title of the application and the version number.<br />

Lines 1519<br />

We declare a Tk variable named cwd to hold the name of the directory we are onwe will see where this<br />

comes in handy later. Another Label is created to display the name of the current directory.<br />

Lines 2129<br />

This section defines the core part of our GUI, (the Listbox) dirs, which contain the list of files of the<br />

directory that is being listed. A Scrollbar is employed to allow the user to move through a listing if the

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!