-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.html
297 lines (191 loc) · 11.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="generator" content="Hugo 0.54.0" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<title> Installing Pygame · KCC Blog </title>
<link rel="stylesheet" href="/blog/css/poole.css">
<link rel="stylesheet" href="/blog/css/syntax.css">
<link rel="stylesheet" href="/blog/css/hyde.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link href="" rel="alternate" type="application/rss+xml" title="KCC Blog" />
</head>
<body class="theme-base-0b">
<div class="sidebar">
<div class="container">
<a href="/blog/">
<img src="/blog//kcc-logo.png" width="150">
<div class="sidebar-about">
</a>
<p class="lead">
Lessons and info about teaching kids to code.
</p>
</div>
<ul class="sidebar-nav">
</ul>
<div class="sidebar-nav">
Tags:
<ul class="sidebar-nav">
<li><a href="/blog//tags/education" class="list-group-item">
<span class="badge">4</span>
education
</a></li>
<li><a href="/blog//tags/gamedev" class="list-group-item">
<span class="badge">59</span>
gamedev
</a></li>
<li><a href="/blog//tags/gamification" class="list-group-item">
<span class="badge">1</span>
gamification
</a></li>
<li><a href="/blog//tags/godot" class="list-group-item">
<span class="badge">42</span>
godot
</a></li>
<li><a href="/blog//tags/procgen" class="list-group-item">
<span class="badge">6</span>
procgen
</a></li>
<li><a href="/blog//tags/pygame" class="list-group-item">
<span class="badge">18</span>
pygame
</a></li>
<li><a href="/blog//tags/python" class="list-group-item">
<span class="badge">20</span>
python
</a></li>
<li><a href="/blog//tags/shaders" class="list-group-item">
<span class="badge">1</span>
shaders
</a></li>
<li><a href="/blog//tags/teaching" class="list-group-item">
<span class="badge">5</span>
teaching
</a></li>
<li><a href="/blog//tags/tutorial" class="list-group-item">
<span class="badge">59</span>
tutorial
</a></li>
</ul>
</div>
<ul class="soc">
<li><a class="soc-twitter" href="http://twitter.com/KidsCanCode"></a></li>
<li><a class="soc-facebook" href="http://facebook.com/Kidscancode"></a></li>
<li><a class="soc-github" href="https://github.com/kidscancode/"></a></li>
<li><a class="soc-youtube" href="https://www.youtube.com/c/KidsCanCodeOrg"></a></li>
<li><a class="soc-rss soc-icon-last" href="/blog/index.xml"></a></li>
</ul>
<p>© 2019 KidsCanCode LLC.</p>
</div>
</div>
<div class="content container">
<div class="post">
<h1>Installing Pygame</h1>
<span class="post-author">by Chris Bradfield</span>
<span class="post-date">Mon, Sep 28, 2015</span>
<span id="tags"> <h6>Tags:
<a href="/blog/tags/python">python</a>
<a href="/blog/tags/pygame">pygame</a>
<a href="/blog/tags/tutorial">tutorial</a>
</h6></span>
<p>Making games is a great way to improve your programming skills while making something fun at the same time. Pygame is a set of tools for Python that make it easy to work with graphics and sound.</p>
<p>Unfortunately, installing Pygame is not as easy as using it is. Below you’ll find the best directions we’ve found for getting it working on your system. Follow the directions below, and let us know in the comments below if you have any problems.</p>
<h1 id="installing-pygame-for-os-x">Installing Pygame for OS X</h1>
<p>Note: For most of these instructions you will need to use the command line. Don’t be intimidated - programmers work on the command line all the time. Once you get used to it, you’ll find it’s the quickest and easiest way to do lots of useful things on the computer.</p>
<p>You access the command line by running the Terminal application - click on the Spotlight icon and type “terminal” to find it.</p>
<h3 id="step-1-install-xcode-command-line-tools">Step 1: Install XCode command line tools</h3>
<p>XCode is the tool from Apple for creating Mac and iOS applications. It can be installed from the <a href="https://itunes.apple.com/us/app/xcode/id497799835?mt=12">App Store</a> (it’s free). When it’s finished, type the following at the command line:</p>
<pre><code>$ xcode-select --install
</code></pre>
<h3 id="step-2-install-homebrew-http-brew-sh">Step 2: Install Homebrew (<a href="http://brew.sh">http://brew.sh</a>)</h3>
<p>Homebrew is a tool to easily install all kinds of software from the command line. It saves you having to go to a bunch of different sites and download lots of individual installers. Copy and paste this on the command line:</p>
<pre><code>$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
</code></pre>
<p>and follow the directions. You’ll also need to install Homebrew Cask (<a href="http://caskroom.io):">http://caskroom.io):</a></p>
<pre><code>$ brew install caskroom/cask/brew-cask
</code></pre>
<h3 id="step-3-install-the-rest-of-the-software">Step 3: Install the rest of the software</h3>
<p>Now we can start installing all the requirements for Pygame. Just type the following commands one at a time and let the computer do its thing:</p>
<pre><code>$ brew cask install xquartz
$ brew install python3
$ brew install python
$ brew linkapps python3
$ brew linkapps python
$ brew install git
$ brew install sdl sdl_image sdl_ttf portmidi libogg libvorbis
$ brew install sdl_mixer --with-libvorbis
$ brew tap homebrew/headonly
$ brew install smpeg
$ brew install mercurial
$ pip3 install hg+http://bitbucket.org/pygame/pygame
</code></pre>
<h3 id="step-4-see-if-it-works">Step 4: See if it works!</h3>
<p>Now we can see if it works. Run Python from the command line:</p>
<pre><code>$ python3
</code></pre>
<p>and try loading Pygame:</p>
<pre><code>>>> import pygame
</code></pre>
<p>If you don’t see an error message, you’re all set! Now head over to our <a href="https://www.youtube.com/c/KidsCanCodeOrg">YouTube Channel</a> and start coding!</p>
<h3 id="important">Important</h3>
<p>You will not be able to use Pygame from IDLE. You will need to run your programs from the command line like this:</p>
<pre><code>$ python3 mygame.py
</code></pre>
<p>Some code editors will also let you run Python programs from inside the program, but we’ll talk about that in a separate post.</p>
<h1 id="installing-pygame-for-windows">Installing Pygame for Windows</h1>
<h3 id="step-1-install-python">Step 1: Install Python</h3>
<p>If you haven’t already, go to <a href="http://python.org/">http://python.org/</a> and download the latest Python installer. Click on “Downloads” and choose “Download Python 3.5.0” (or whatever the latest version is).</p>
<p>When the download finishes, choose “run” - you may need to open your Downloads folder and double-click on the installer file.</p>
<p>Check the box labeled “Add Python 3.5 to PATH” and then click “Customize Installation”. Under “Optional Features” make sure all the boxes are checked. Under “Advanced Options” you can leave it as-is. Then click the Install button and let the computer complete the process.</p>
<h3 id="step-2-install-pygame-for-windows">Step 2: Install Pygame for Windows</h3>
<p>Click <a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame">here</a> and download the appropriate installer for your computer. For most people, this will be the latest 32-bit installer, for example:</p>
<pre><code>pygame‑1.9.2a0‑cp35‑none‑win32.whl
</code></pre>
<p>Choose “Save” and let the file download.</p>
<p>Now, you need to go to the command line. In your Start Menu search for “command” and you’ll see a button for “Command Prompt”.</p>
<p>Type the following:</p>
<pre><code>C:\Users\name\> cd Downloads
C:\Users\name\Downloads> pip install pygame-1.9.2a0-cp35-none-win32.whl
</code></pre>
<h3 id="step3-see-if-it-works">Step3: See if it works!</h3>
<p>Now we can see if it works. Run Python from the command line:</p>
<pre><code>C:\Users\name\Downloads> python
</code></pre>
<p>and try loading Pygame:</p>
<pre><code>>>> import pygame
</code></pre>
<p>If you don’t see an error message, you’re all set! Now head over to our <a href="https://www.youtube.com/c/KidsCanCodeOrg">YouTube Channel</a> and start coding!</p>
</div>
<h2>Comments</h2>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'kidscancode';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</div>
</body>
</html>