[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版

(yzsuai) #1
prior versions, it used tools in Launcher.py to search for a reasonable browser to
run. The original version of this example has now been largely superseded by the
standard library’s webbrowser module, which arose after this example had been
developed (reptilian minds think alike!). In this edition, LaunchBrowser simply par-
ses command-line arguments for backward compatibility and invokes the open
function in webbrowser. See this module’s help text, or PyGadgets and PyDemos in
Chapter 10, for example command-line usage.

That’s the end of our system tools exploration. In the next part of this book we leave
the realm of the system shell and move on to explore ways to add graphical user inter-
faces to our program. Later, we’ll do the same using web-based approaches. As we
continue, keep in mind that the system tools we’ve studied in this part of the book see
action in a wide variety of programs. For instance, we’ll put threads to work to spawn
long-running tasks in the GUI part, use both threads and processes when exploring
server implementations in the Internet part, and use files and file-related system calls
throughout the remainder of the book.


Whether your interfaces are command lines, multiwindow GUIs, or distributed client/
server websites, Python’s system interfaces toolbox is sure to play a important part in
your Python programming future.


352 | Chapter 6: Complete System Programs

Free download pdf