[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版
class SourceLines(LinesByType): srcExts = ['.py', '.pyw', '.cgi', '.html', '.c', '.cxx', '.h', '.i'] if name == 'main': walker = ...
The trick I eventually stumbled onto is not to keep track at all. Instead, the script in Example 6-22 simply replaces the “from” ...
This version accomplishes roughly the same goal as the original, but it has made a few assumptions to keep the code simple. The ...
Most of these are almost as trivial as the visitor_edit.py code in Example 6-19, because the visitor framework handles walking d ...
In fact, those needs have changed over time. Between the third and fourth editions of this book, the original os.path.walk call ...
import os, sys, mimetypes, webbrowser helpmsg = """ Sorry: can't find a media player for '%s' on your system! Add an entry for y ...
'win32': Winstart() # startfile or system 'win32': Cmdline('start %s') } videotools = { 'linux2': Cmdline('tkcVideo_c700 %s'), # ...
else: trywebbrowser(filename, **options) # general scheme def playfile(filename, mimetable=mimetable, options): """ play media f ...
determine media type from file name. Since these are the heart of this code’s matter, let’s explore these briefly before we run ...
On Windows, for example, all three simply run os.startfile by default and thus create a new tab in an existing window under Inte ...
>>> mimetypes.guess_type('spam.html')[0].split('/')[1] 'html' A subtle thing: the second item in the tuple returned fro ...
.txt ('text/plain', None) .py ('text/x-python', None) .pyw (None, None) .html ('text/html', None) .c ('text/plain', None) .h ('t ...
Because the programs used and their behavior may vary widely from machine to ma- chine, though, you’re best off studying this sc ...
prior versions, it used tools in Launcher.py to search for a reasonable browser to run. The original version of this example has ...
PART III GUI Programming This part of the book shows you how to apply Python to build portable graphical user interfaces, primar ...
...
CHAPTER 7 Graphical User Interfaces “Here’s Looking at You, Kid” For most software systems, a graphical user interface (GUI) has ...
Chapters 8 and 9 take you on a tour of the tkinter widget set.* Roughly, Chap- ter 8 presents simple widgets and Chapter 9 cove ...
Running the Examples One other point I’d like to make right away: most GUIs are dynamic and interactive interfaces, and the best ...
Python GUI Development Options Before we start wading into the tkinter pond, let’s begin with some perspective on Python GUI opt ...
«
15
16
17
18
19
20
21
22
23
24
»
Free download pdf