售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Python 2.6 Graphics Cookbook
Table of Contents
Python 2.6 Graphics Cookbook
Credits
About the Author
About the Reviewers
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Start your Engines
Introduction
Running a shortest Python program
How to do it...
How it works...
There's more...
Ensuring that the Python modules are present
How to do it...
How it works...
There's more...
A basic Tkinter program
How to do it...
How it works...
Make a compiled executable under Windows and Linux
Getting ready
How to do it under MS Windows...
How to do it under Linux (Debian and Ubuntu)...
How to compile under both Linux and MS Windows...
How it works...
2. Drawing Fundamental Shapes
Introduction
A straight line and the coordinate system
How to do it...
How it works...
There's more...
Draw a dashed line
How to do it...
How it works...
There's more...
Lines of varying styles with arrows and endcaps
How to do it...
How it works...
There's more...
A two segment line with a sharp bend
How to do it...
How it works...
There's more...
A line with a curved bend
How to do it...
How it works...
There's more...
Drawing intricate shapes – the curly vine
Getting ready
How to do it…
How it works...
There's more...
Draw a rectangle
How to do it...
How it works...
There's more...
Draw overlapping rectangles
How to do it...
How it works...
There's more...
Draw concentric squares
How to do it...
How it works...
A circle from an oval
How to do it...
How it works...
There's more...
A circle from an arc
How to do it...
How it works...
There's more...
Three arc ellipses
How to do it...
How it works...
There's more...
Polygons
How to do it...
How it works...
A star polygon
How to do it...
How it works...
Cloning and resizing stars
How to do it...
How it works...
There's more...
3. Handling Text
Introduction
Simple text
How to do it...
How it works...
There's more...
Text font type, size, and color
Getting ready
How to do it...
How it works...
There's more...
Getting ready
How to do it...
How it works...
Alignment of text – left and right justify
Getting ready
How to do it...
How it works...
All the fonts available on your computer
How to do it...
How it works...
4. Animation Principles
Introduction
Static shifting of a ball
How to do it...
How it works...
There's more...
Time-controlled shifting of a ball
How to do it...
How it works...
There's more...
The robustness of Tkinter
Complete animation using draw-move-pause-erase cycles
How to do it...
How it works...
There's more...
More than one moving object
How to do it...
How it works...
There's more...
A ball that bounces
How to do it...
How it works...
Bouncing in a gravity field
How to do it...
How it works...
There's more...
See also
Precise collisions using floating point numbers
How to do it...
How it works...
A graphic debugging tool...
Trajectory tracing and ball-to-ball collisions
How to do it...
How it works...
There's more...
Why do we sometimes get tkinter.TckErrors?
Rotating line
Getting ready
How to do it...
How it works...
There's more...
Trajectory tracing on multiple line rotations
Getting ready
How to do it...
How it works...
There's more...
A rose for you
How it works...
5. The Magic of Color
Introduction
A limited palette of named colors
How to do it...
How it works...
There's more...
To get fine shadings of the primary colors
A more compact color list
Nine ways of specifying color
How to do it...
How it works...
Converting color tuples to Tkinter Hex compatible specifiers
A red beachball of varying hue
How to do it...
How it works...
There's more...
A red color wedge of graded hue
How to do it...
How it works...
There's more...
Newton's grand wheel of color mixing
How to do it...
How it works...
There's more...
The numerical color mixing matching palette
How to do it...
How it works...
There's more...
There are other tools to select colors
Is there a way to make neater slide controllers?
The animated graded color wheel
How to do it...
How it works...
Tkinter's own color picker-mixer
How to do it...
How it works...
There's more...
6. Working with Pictures
Opening an image file and discovering its attributes
Getting ready
How to do it...
How it works...
There's more...
Things we need to know about image formats
Images and the numbers game
Open, view, and save an image in a different file format
Getting ready
How to do it...
How it works...
There's more...
Image format conversion for JPEG, PNG, TIFF, GIF, BMP
Getting ready
How to do it...
How it works...
There's more...
Does size count?
Image rotation in the plane of the image
Getting ready
How to do it...
How it works...
There's more...
Image size alteration
Getting ready
How to do it...
How it works...
There's more...
How do we preserve the correct height-to-width ratio of an image?
Correct proportion image resizing
Getting ready
How to do it...
How it works...
Separating one color band in an image
Getting ready
How to do it...
How it works...
There's more...
Red, green, and blue color alteration in images
Getting ready
How to do it...
How it works...
There's more...
Slider controlled color manipulation
Getting ready
How to do it...
How it works...
Combining images by blending
Getting ready
How to do it...
There's more...
More Info Section 1
Blending images by varying percentages
How to do it...
How it works...
There's more...
Make a composite image using a mask image
Getting ready
How to do it...
How it works...
There's more...
See also
Offset (roll) image horizontally and vertically
Getting ready
How to do it...
How it works...
Flip horizontally, vertically, and rotate
Getting ready
How to do it...
How it works...
Filter effects: blur, sharpen, contrast, and so on
Getting ready
How to do it...
How it works...
Getting ready
How to do it...
How it works...
There's more...
7. Combining Raster and Vector Pictures
Simple animation of a GIF beach ball
Getting ready
How to do it...
How it works...
The vector walking creature
Getting ready
How to do it...
How it works...
There's more...
More Info Section 1
Bird with shoes walking in the Karroo
Getting ready
How to do it...
How it works...
There's more...
Making GIF images with transparent backgrounds using GIMP
Getting ready
How to do it...
How it works...
Diplomat walking at the palace
Getting ready
How to do it...
How it works...
Spider in the forest
Getting ready
How to do it...
How it works...
There's more...
Moving band of images
Getting ready
How to do it...
How it works...
Continuous band of images
Getting ready
How to do it...
How it works...
Endless background
Getting ready
How to do it...
How it works...
8. Data In and Data Out
Introduction
Creation of a new file on a hard drive
How to do it...
How it works...
How to read the newly created file
Writing data to a newly-created file
How it works...
Writing data to multiple files
How it works...
Adding data to existing files
How it works...
So remember the difference between write and append
Saving a Tkinter-drawing shape to disk
Getting ready
How to do it...
How it works...
Retrieving Python data from disk storage
Getting ready
How it works...
Simple mouse input
How it works...
There's more...
Storing and retrieving a mouse-drawn shape
Getting ready
How it works...
There's more...
We need to edit mistakes
A mouse-line editor
Getting ready
How it works...
There's more...
Why don't we add more features?
Using other tools to acquire and re-work images
How to exploit that mouse
We can measure the distance along a meandering line
All possible mouse actions
How to do it...
How it works...
There's more...
9. Exchanging Inkscape SVG Drawings with Tkinter Shapes
Introduction
The structure of an SVG drawing
Getting ready
How to do it...
How it works...
There's more...
SVG code for separate paths
Tracing the shape of an image in Inkscape
Getting ready
How to do it...
Another way to get SVG paths from raster images
Converting an SVG path into a Tkinter Line
Getting ready
How to do it...
How it works...
There's more...
How far should we go with image conversion code?
Another way to get SVG paths from raster images
10. GUI Construction: Part 1
Introduction
Widget configuration – a label
How to do it...
How it works...
There's more...
Button focus
How to do it...
How it works...
There's more...
The simplest push button with validation
How to do it...
How it works...
There's more...
Buttons behave differently on Windows
A data entry box
How to do it...
How it works...
There's more...
Did we keep things simple?
Single-line versus multi-line entry
The Clever Geometry Manager
Colored button causing a message pop-up
How to do it...
How it works...
Complex interaction between buttons
How to do it...
How it works...
Images on buttons and button packing
How to do it...
How it works...
There's more...
Grid Geometry Manager and button arrays
How to do it...
How it works...
There's more...
Drop-down menus to select from a list
How to do it...
How it works...
Listbox variable selection
How to do it...
How it works...
Text in a window
How to do it...
How it works...
11. GUI Construction: Part 2
Introduction
The Grid Layout Geometry Manager
Getting ready
How to do it...
How it works...
There's more...
The Pack Geometry Manager
Getting ready
How to do it...
How it works...
Radiobuttons to select one from many
How to do it...
How it works...
Checkbuttons (Tickboxes) to select some of many
How to do it...
How it works...
Key-stroke event handling
How to do it...
How it works...
Scrollbar
How to do it...
How it works...
There's more...
Custom DIY controller widgets
How to do it...
How it works...
There's more...
Organizing widgets inside frames
How to do it...
How it works...
There's more...
A. Quick tips for running Python programs in Microsoft Windows
Running Python programs in Microsoft Windows
Where will we find the windows installer?
Do we have to use Python version 2.7?
Why do we get "python is not recognized…"?
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜