|
226 | 226 |
|
227 | 227 | <body>
|
228 | 228 | <header>
|
229 |
| - <aside>October 2, 2021</aside> |
| 229 | + <aside>October 4, 2021</aside> |
230 | 230 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a>
|
231 | 231 | </header>
|
232 | 232 |
|
|
537 | 537 | </code></pre></div>
|
538 | 538 |
|
539 | 539 | <ul>
|
540 |
| -<li><strong>Use <code class="python hljs"><span class="hljs-string">'{<el>:{<str/int/float>}[...]}'</span></code> to set options dynamically.</strong></li> |
| 540 | +<li><strong>Options can be generated dynamically: <code class="python hljs"><span class="hljs-string">f'<span class="hljs-subst">{<el>:{<str/int>}</span>[…]}'</span></code>.</strong></li> |
541 | 541 | <li><strong>Adding <code class="python hljs"><span class="hljs-string">'!r'</span></code> before the colon converts object to string by calling its <a href="#class">repr()</a> method.</strong></li>
|
542 | 542 | </ul>
|
543 |
| -<div><h3 id="strings">Strings</h3><pre><code class="python language-python hljs">{<span class="hljs-string">'abcde'</span>!r:<span class="hljs-number">10</span>} <span class="hljs-comment"># "'abcde' "</span> |
| 543 | +<div><h3 id="strings">Strings</h3><pre><code class="python language-python hljs">{<span class="hljs-string">'abcde'</span>:<span class="hljs-number">10</span>} <span class="hljs-comment"># 'abcde '</span> |
544 | 544 | {<span class="hljs-string">'abcde'</span>:<span class="hljs-number">10.3</span>} <span class="hljs-comment"># 'abc '</span>
|
545 | 545 | {<span class="hljs-string">'abcde'</span>:<span class="hljs-number">.3</span>} <span class="hljs-comment"># 'abc'</span>
|
| 546 | +{<span class="hljs-string">'abcde'</span>!r:<span class="hljs-number">10</span>} <span class="hljs-comment"># "'abcde' "</span> |
546 | 547 | </code></pre></div>
|
547 | 548 |
|
548 |
| -<div><h3 id="numbers-1">Numbers</h3><pre><code class="python language-python hljs">{ <span class="hljs-number">123456</span>:<span class="hljs-number">10</span>,} <span class="hljs-comment"># ' 123,456'</span> |
| 549 | +<div><h3 id="numbers-1">Numbers</h3><pre><code class="python language-python hljs">{ <span class="hljs-number">123456</span>:<span class="hljs-number">10</span>} <span class="hljs-comment"># ' 123456'</span> |
| 550 | +{ <span class="hljs-number">123456</span>:<span class="hljs-number">10</span>,} <span class="hljs-comment"># ' 123,456'</span> |
549 | 551 | { <span class="hljs-number">123456</span>:<span class="hljs-number">10</span>_} <span class="hljs-comment"># ' 123_456'</span>
|
550 | 552 | { <span class="hljs-number">123456</span>:+<span class="hljs-number">10</span>} <span class="hljs-comment"># ' +123456'</span>
|
551 | 553 | {<span class="hljs-number">-123456</span>:=<span class="hljs-number">10</span>} <span class="hljs-comment"># '- 123456'</span>
|
|
2538 | 2540 | <list> = <Rect>.collidelistall(<list_of_Rect>) <span class="hljs-comment"># Returns indexes of all colliding Rects.</span>
|
2539 | 2541 | </code></pre>
|
2540 | 2542 | <div><h3 id="surface">Surface</h3><p><strong>Object for representing images.</strong></p><pre><code class="python language-python hljs"><Surf> = pg.display.set_mode((width, height)) <span class="hljs-comment"># Returns display surface.</span>
|
2541 |
| -<Surf> = pg.Surface((width, height), …) <span class="hljs-comment"># New RGB surface. Add `pg.SRCALPHA` for RGBA.</span> |
| 2543 | +<Surf> = pg.Surface((width, height) [, flags]) <span class="hljs-comment"># New RGB surface. RGBA if `flags=pg.SRCALPHA`.</span> |
2542 | 2544 | <Surf> = pg.image.load(<span class="hljs-string">'<path>'</span>) <span class="hljs-comment"># Loads the image. Format depends on source.</span>
|
2543 | 2545 | <Surf> = <Surf>.subsurface(<Rect>) <span class="hljs-comment"># Returns a subsurface.</span>
|
2544 | 2546 | </code></pre></div>
|
|
3005 | 3007 |
|
3006 | 3008 |
|
3007 | 3009 | <footer>
|
3008 |
| - <aside>October 2, 2021</aside> |
| 3010 | + <aside>October 4, 2021</aside> |
3009 | 3011 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a>
|
3010 | 3012 | </footer>
|
3011 | 3013 |
|
|
0 commit comments