<pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span>[l+r <spanclass="hljs-keyword">for</span> l <spanclass="hljs-keyword">in</span><spanclass="hljs-string">'abc'</span><spanclass="hljs-keyword">for</span> r <spanclass="hljs-keyword">in</span><spanclass="hljs-string">'abc'</span>]
<div><h3id="anyall">Any, All</h3><pre><codeclass="python language-python hljs"><bool> = any(<collection>) <spanclass="hljs-comment"># Is `bool(<el>)` True for any element.</span>
<bool> = all(<collection>) <spanclass="hljs-comment"># Is True for all elements or empty.</span>
<pre><codeclass="bash hljs"><2d_bools> = <2d_array>><== <el/1d/2d_array><spanclass="hljs-comment"># 1d_array must have size of a row.</span>
<1d/2d_a> = <2d_array>[<2d/1d_bools>] <spanclass="hljs-comment"># 1d_bools must have size of a column.</span>
@ -2259,7 +2258,7 @@ right = [[<span class="hljs-number">0.1</span>, <span class="hljs-number">0.6</
<Image> = Image.open(<path>) <spanclass="hljs-comment"># Identifies format based on file contents.</span>
<Image> = <Image>.convert(<spanclass="hljs-string">'<mode>'</span>) <spanclass="hljs-comment"># Converts image to the new mode.</span>
<Image>.save(<path>) <spanclass="hljs-comment"># Selects format based on the path extension.</span>
<Image>.show() <spanclass="hljs-comment"># Opens image in default preview app.</span>
<Image>.show() <spanclass="hljs-comment"># Opens image in the default preview app.</span>
</code></pre>
<pre><codeclass="python language-python hljs"><int/tuple> = <Image>.getpixel((x, y)) <spanclass="hljs-comment"># Returns a pixel.</span>
<Image>.putpixel((x, y), <int/tuple>) <spanclass="hljs-comment"># Writes a pixel to the image.</span>
@ -2463,7 +2462,8 @@ rect = pg.Rect(<span class="hljs-number">240</span>, <span class="hljs-number">2
</code></pre>
<div><h3id="surface">Surface</h3><p><strong>Object for representing images.</strong></p><pre><codeclass="python language-python hljs"><Surf> = pg.display.set_mode((width, height)) <spanclass="hljs-comment"># Opens new window and returns its surface.</span>
<Surf> = pg.Surface((width, height)) <spanclass="hljs-comment"># New RGB surface. RGBA if `flags=pg.SRCALPHA`.</span>
<Surf> = pg.image.load(<spanclass="hljs-string">'<path>'</span>) <spanclass="hljs-comment"># Loads the image. Format depends on source.</span>
<Surf> = pg.image.load(<path/file>) <spanclass="hljs-comment"># Loads the image. Format depends on source.</span>
<Surf> = pg.surfarray.make_surface(<np_array>) <spanclass="hljs-comment"># Also `<array> = surfarray.pixels3d(<Surf>)`.</span>
<Surf> = <Surf>.subsurface(<Rect>) <spanclass="hljs-comment"># Returns a subsurface.</span>
rect(<Surf>, color, <Rect>, width=<spanclass="hljs-number">0</span>) <spanclass="hljs-comment"># Also polygon(<Surf>, color, points, width=0).</span>
</code></pre>
<div><h3id="font">Font</h3><pre><codeclass="python language-python hljs"><Font> = pg.font.SysFont(<spanclass="hljs-string">'<name>'</span>, size) <spanclass="hljs-comment"># Loads the system font or default if missing.</span>
<Font> = pg.font.Font(<spanclass="hljs-string">'<path>'</span>, size) <spanclass="hljs-comment"># Loads the TTF file. Pass None for default.</span>
<div><h3id="font">Font</h3><pre><codeclass="python language-python hljs"><Font> = pg.font.Font(<path/file>, size) <spanclass="hljs-comment"># Loads the TTF file. Pass None for default.</span>
<Surf> = <Font>.render(text, antialias, color) <spanclass="hljs-comment"># Background color can be specified at the end.</span>
</code></pre></div>
<div><h3id="sound">Sound</h3><pre><codeclass="python language-python hljs"><Sound> = pg.mixer.Sound(<spanclass="hljs-string">'<path>'</span>) <spanclass="hljs-comment"># Loads the WAV file.</span>
<div><h3id="sound">Sound</h3><pre><codeclass="python language-python hljs"><Sound> = pg.mixer.Sound(<path/file/bytes>)<spanclass="hljs-comment"># Loads the WAV file or array of signed shorts.</span>
<Sound>.play() <spanclass="hljs-comment"># Starts playing the sound.</span>
<pre><codeclass="python language-python hljs"><Sr> = <Sr>><== <el/Sr><spanclass="hljs-comment"># Returns a Series of bools.</span>