| 
1914 | 1914 | </code></pre></div>  | 
1915 | 1915 | 
 
  | 
1916 | 1916 | <div><h3 id="parameters-1">Parameters</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> inspect <span class="hljs-keyword">import</span> signature  | 
1917 |  | -<sig>  = signature(<function>)             <span class="hljs-comment"># Signature object of the function.</span>  | 
1918 |  | -<dict> = <sig>.parameters                  <span class="hljs-comment"># Dict of function's parameters.</span>  | 
1919 |  | -<str>  = <param>.name                      <span class="hljs-comment"># Prameter's name.</span>  | 
1920 |  | -<memb> = <param>.kind                      <span class="hljs-comment"># Member of ParameterKind enum.</span>  | 
 | 1917 | +<Sig>  = signature(<function>)             <span class="hljs-comment"># Signature object of the function.</span>  | 
 | 1918 | +<dict> = <Sig>.parameters                  <span class="hljs-comment"># Dict of function's Parameter objects.</span>  | 
 | 1919 | +<str>  = <Param>.name                      <span class="hljs-comment"># Parameter's name.</span>  | 
 | 1920 | +<memb> = <Param>.kind                      <span class="hljs-comment"># Member of ParameterKind enum.</span>  | 
1921 | 1921 | </code></pre></div>  | 
1922 | 1922 | 
 
  | 
1923 | 1923 | <div><h2 id="metaprograming"><a href="#metaprograming" name="metaprograming">#</a>Metaprograming</h2><p><strong>Code that generates code.</strong></p><div><h3 id="type-1">Type</h3><p><strong>Type is the root class. If only passed an object it returns its type (class). Otherwise it creates a new class.</strong></p><pre><code class="python language-python hljs"><class> = type(<span class="hljs-string">'<class_name>'</span>, <parents_tuple>, <attributes_dict>)</code></pre></div></div>  | 
 | 
2546 | 2546 | <Surf>.set_at((x, y), color)                    <span class="hljs-comment"># Updates pixel.</span>  | 
2547 | 2547 | <Surf>.blit(<Surf>, (x, y))                     <span class="hljs-comment"># Draws passed surface to the surface.</span>  | 
2548 | 2548 | </code></pre>  | 
2549 |  | -<pre><code class="python language-python hljs"><Surf> = pg.transform.scale(<Surf>, (width, height))  | 
2550 |  | -<Surf> = pg.transform.rotate(<Surf>, degrees)  | 
2551 |  | -<Surf> = pg.transform.flip(<Surf>, x_bool, y_bool)  | 
 | 2549 | +<pre><code class="python language-python hljs"><span class="hljs-keyword">import</span> pygame.transform <span class="hljs-keyword">as</span> tr  | 
 | 2550 | +<Surf> = tr.scale(<Surf>, (width, height))      <span class="hljs-comment"># Returns scaled surface.</span>  | 
 | 2551 | +<Surf> = tr.rotate(<Surf>, degrees)             <span class="hljs-comment"># Returns rotated and scaled surface.</span>  | 
 | 2552 | +<Surf> = tr.flip(<Surf>, x_bool, y_bool)        <span class="hljs-comment"># Returns flipped surface.</span>  | 
2552 | 2553 | </code></pre>  | 
2553 |  | -<pre><code class="python language-python hljs">pg.draw.line(<Surf>, color, (x1, y1), (x2, y2), width)  | 
2554 |  | -pg.draw.arc(<Surf>, color, <Rect>, from_radians, to_radians)  | 
2555 |  | -pg.draw.rect(<Surf>, color, <Rect>)  | 
2556 |  | -pg.draw.polygon(<Surf>, color, points)  | 
2557 |  | -pg.draw.ellipse(<Surf>, color, <Rect>)  | 
 | 2554 | +<pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> pygame.draw <span class="hljs-keyword">import</span> line, arc, rect  | 
 | 2555 | +line(<Surf>, color, (x1, y1), (x2, y2), width)  <span class="hljs-comment"># Draws a line to the surface.</span>  | 
 | 2556 | +arc(<Surf>, color, <Rect>, from_rad, to_rad)    <span class="hljs-comment"># Also: ellipse(<Surf>, color, <Rect>)</span>  | 
 | 2557 | +rect(<Surf>, color, <Rect>)                     <span class="hljs-comment"># Also: polygon(<Surf>, color, points)</span>  | 
2558 | 2558 | </code></pre>  | 
2559 | 2559 | <div><h3 id="font">Font</h3><pre><code class="python language-python hljs"><Font> = pg.font.SysFont(<span class="hljs-string">'<name>'</span>, size)        <span class="hljs-comment"># Loads the system font or default if missing.</span>  | 
2560 | 2560 | <Font> = pg.font.Font(<span class="hljs-string">'<path>'</span>, size)           <span class="hljs-comment"># Loads the TTF file. Pass None for default.</span>  | 
 | 
0 commit comments