Python Geek Project Programming pdf

Source: Internet
Author: User
Tags flock generator

: Network Disk Download

Content Introduction· · · · · ·

python is a powerful programming language that is easy to learn and fun. But after mastering the basics, what do you do next?

This book contains a set of imaginative programming projects that will guide you in using Python to create images and music, simulate real-world phenomena, and with

arduino to interact with hardware such as Raspberry Pi. You will learn to use common Python tools and libraries, such as NumPy, Matplotlib, and Pygame,

using parametric equations and turtle modules to generate a flower-scale pattern;

P style= "margin:0px; Text-indent:2em "> convert graphic images to ASCII text graphics;

write a three-dimensional painting program that generates 3D images hidden under random patterns;

Create realistic animations using OpenGL shaders by exploring particle systems, transparency, and billboard technology;

3D visualization using data from CT and MRI scans,

connect your computer to Arduino programming, Create a laser show that responds to music.

Through this book, you can enjoy the real fun as a geek!

Author profile ...

About the author

Mahesh Venkitachalam is a software engineer with 20 years of programming experience. He has been developing a passion for technology from the eight grade, bringing together his popular electronic and programming blog: electronut.in.

Catalog/Directory
First part warm-up exercise
1th Chapter parsing itunes playlists 3
1.1 itunes playlist File Anatomy 3
1.2 Required Modules 5
1.3 Code 5
1.3.1 Find Duplicates 5
1.3.2 Extract Repeat 6
1.3.3 finding common tracks in multiple playlists 7
1.3.4 Collecting Statistics 8
1.3.5 Plotting Data 8
1.3.6 Command Line Options 9
1.4 Full Code 10
1.5 Running the program 13
1.6 Summary 14
1.7 Experiment 14
2nd million Flower ruler 15
2.1 Parametric Equation 16
2.1.1 million flower scale equation 17
2.1.2 Turtle Drawing 19
2.2 Required Modules 20
2.3 Code 20
2.3.1 Spiro Constructor 20
2.3.2 Setting the function 21
2.3.3 Restart () method 21
2.3.4 Draw () method 22
2.3.5 Creating an animation 22
2.3.5 Spiroanimator Class 23
2.3.5 Genrandomparams () method 24
2.3.6 restarting the program 24
2.3.7 Update () method 25
2.3.8 Show or hide the cursor 25
2.3.9 Save Curve 25
2.3.10 parsing command-line arguments and initialization 26
2.4 Full Code 27
2.5 Running the flower ruler animation 32
2.6 Summary 33
2.7 Experiment 33
The second part simulates life
3rd Chapter Conway Life Game 37
3.1 Working principle 38
3.2 Required Modules 39
3.3 Code 40
3.3.1 means grid 40
3.3.2 Initial Conditions 41
3.3.3 Boundary Conditions 41
3.3.4 Implementation Rules 42
3.3.5 sending command-line arguments to a program 43
3.3.6 Initialization Simulation 43
3.4 Full Code 44
3.5 Running a Sims game 46
3.6 Summary 47
3.7 Experiment 47
The 4th chapter uses the Karplus-strong algorithm to produce musical overtones 49
4.1 Working principle 51
4.1.1 Simulation 51
4.1.2 Creating a WAV file 52
4.1.3 Minor five sound levels 53
4.2 Required Modules 54
4.3 Code 54
4.3.1 implementing ring buffers with Deque 54
4.3.2 Implementing the Karplus-strong algorithm 55
4.3.3 Write WAV Files 56
4.3.4 playing WAV files with Pygame 56
4.3.5 Main () method 57
4.4 Full Code 58
4.5 Running the chord simulation 61
4.6 Summary 62
4.7 Experiment 62
5th-Class Bird Group: simulation birds 63
5.1 Working principle 64
5.2 Required Modules 64
5.3 Code 64
5.3.1 calculating the position and velocity of a flock of birds 65
5.3.2 Setting Boundary conditions 66
5.3.3 draw a flock of birds 67
5.3.4 rules for the application of avian populations 68
5.3.5 adding individuals 70
5.3.6 disperse flock of birds 71
5.3.7 Command line parameter 71
5.3.8 Boids Class 71
5.4 Full Code 72
5.5 Run-like bird swarm simulation 75
5.6 Summary 76
5.7 Experiment 76
The third part of the picture music
6th. ASCII text Graphics 79
6.1 Working principle 80
6.2 Required Modules 81
6.3 Code 81
6.3.1 defining the grayscale level and grid 82
6.3.2 Calculate Average Brightness 82
6.3.3 generating ASCII content from images 83
6.3.4 Command Line Options 84
6.3.5 writing ASCII text graphics strings to a text file 84
6.4 Full Code 85
6.5 Running the ASCII text graphics generator 87
6.6 Summary 87
6.7 Experiment 88
7th Chapter Photo Mosaic 89
7.1 Working principle 90
7.1.1 Segmentation Target Image 90
7.1.2 Average color value 91
7.1.3 Matching Image 91
7.2 Required Modules 92
7.3 Code 92
7.3.1 reading a small block image 92
7.3.2 Calculating the average color value of an input image 93
7.3.3 dividing a target image into a grid 93
7.3.4 looking for small pieces of * Good match 94
7.3.5 Creating an Image grid 95
7.3.6 creating a photo mosaic 96
7.3.7 adding command-line Options 97
7.3.8 control the size of photo mosaics 97
7.4 Full Code 98
7.6 Running photo Mosaic Generator 102
7.7 Summary 103
7.7 Experiment 103
8th three-dimensional painting 105
8.1 Working principle 106
8.1.1 perception of depth in three-dimensional painting 106
8.1.2 Depth Figure 108
8.2 Required Modules 109
8.3 Code 109
8.3.1 repeating a given tile image 109
8.3.2 from creating a random circle Tile 110
8.3.3 create three-dimensional painting 111
8.3.4 Command line Options 112
8.4 Full Code 113
8.5 running three-dimensional drawing generation program 115
8.6 Summary 117
8.7 Experiment 117
Part IV walks into three-dimensional
9th Chapter Understanding OpenGL 121
9.1 Old-fashioned OpenGL 122
9.2 Modern OpenGL: three-dimensional graphics pipeline 124
9.2.1 Geometric entity 124
9.2.23-dimensional Transformation 125
9.2.3 Shader 127
9.2.4 Vertex Buffer 128
9.2.5 Texture Map 129
9.2.6 Display OpenGL 129
9.3 Required Modules 130
9.4 Code 130
9.4.1 Creating OpenGL Windows 130
9.4.2 Set Callback 131
9.4.3 Scene Class 133
9.5 Full Code 137
9.6 Running OpenGL applications 142
9.7 Summary 143
9.8 Experiment 143
10th Particle System 145
10.1 Working principle 146
10.1.1 modeling for particle motion 147
10.1.2 Setting the maximum range 147
10.1.3 Rendering Particles 149
10.1.4 using OpenGL blending to create more realistic sparks 149
10.1.5 using the bulletin board 150
10.1.6 generating Spark animations 151
10.2 Required Modules 151
10.3 Code for the particle system 151
10.3.1 defining the geometry of a particle 152
10.3.2 defining time-delay arrays for particles 153
10.3.3 set particle initial speed 153
10.3.4 creating a vertex shader 154
10.3.5 creating a fragment shader 156
10.3.6 Rendering 156
10.3.7 Camera Class 158
10.4 Particle System Complete Code 158
10.5 Box Code 164
10.6 Main program Code 166
10.6.1 each step to update these particles 167
10.6.2 Keyboard Handling Program 168
10.6.3 managing the main program Loop 168
10.7 Full Main program code 169
10.8 Running the program 172
10.9 Summary 172
10.10 Experiment 172
Chapter 11th Body Rendering 173
11.1 Working principle 174
11.1.1 Data Format 174
11.1.2 Generating Light 175
11.1.3 Display OpenGL window 177
11.2 Required Modules 178
11.3 Project Code Overview 178
11.4 Creating a three-dimensional texture 178
11.5 Complete three-dimensional texture code 180
11.6 Generating Light 181
11.6.1 defining the geometric shape of a color cube 182
11.6.2 creating a Frame Buffer object 184
11.6.3 rendering the back of the Cube 185
11.6.4 rendering the front of the Cube 185
11.6.5 rendering the entire cube 186
11.6.6 Sizing Handlers 187
11.7 Complete Light Generation code 187
11.8 Body Ray projection 192
11.8.1 Vertex Shader 194
11.8.2 Fragment Shader 194
11.9 Complete Body Ray projection code 196
11.10 Two-dimensional slicing 199
11.10.1 Vertex Shader 201
11.10.2 Fragment Shader 202
11.10.3 user interface for two-dimensional slicing 202
11.11 complete two-dimensional slicing code 203
11.12 Code Integration 206
11.13 Complete main file code 207
11.14 Running the program 209
11.15 Summary 210
11.16 Experiment 210
Part V playing hardware
12th Chapter introduction of Arduino 215
12.1 Arduino 216
12.2 Arduino Ecosystem 217
12.2.1 Language 218
12.2.2 IDE 218
12.2.3 Community 218
12.2.4 Peripherals 219
12.3 Required Modules 219
12.4 Building a photosensitive circuit 219
12.4.1 Circuit Operating Principle 219
12.4.2 Arduino Program 220
12.4.3 Creating live Charts 221
12.5 Python Code 222
12.6 Full Python code 224
12.7 Running the program 226
12.8 Summary 227
12.9 Experiment 227
......
13th Laser Music Show 229
14th. Raspberry Pi based Weather monitor 253
Appendix A Software Installation 275
Appendix B Basic Practical Electronics 281
Appendix C Raspberry Pi Tips and tricks 289
Abstracts
Copyright page:

: Network Disk Download

Python Geek Project Programming pdf

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.