|
56 | 56 |
|
57 | 57 | <body>
|
58 | 58 | <header>
|
59 |
| - <aside>May 8, 2025</aside> |
| 59 | + <aside>May 9, 2025</aside> |
60 | 60 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a>
|
61 | 61 | </header>
|
62 | 62 |
|
|
1591 | 1591 | <conn>.execute(<span class="hljs-string">'<query>'</span>) <span class="hljs-comment"># depending on whether any exception occurred.</span>
|
1592 | 1592 | </code></pre></div>
|
1593 | 1593 |
|
1594 |
| -<div><h3 id="placeholders">Placeholders</h3><pre><code class="python language-python hljs"><conn>.execute(<span class="hljs-string">'<query>'</span>, <list/tuple>) <span class="hljs-comment"># Replaces '?'s in query with values.</span> |
1595 |
| -<conn>.execute(<span class="hljs-string">'<query>'</span>, <dict/namedtuple>) <span class="hljs-comment"># Replaces ':<key>'s with values.</span> |
| 1594 | +<div><h3 id="placeholders">Placeholders</h3><pre><code class="python language-python hljs"><conn>.execute(<span class="hljs-string">'<query>'</span>, <list/tuple>) <span class="hljs-comment"># Replaces every question mark with an item.</span> |
| 1595 | +<conn>.execute(<span class="hljs-string">'<query>'</span>, <dict/namedtuple>) <span class="hljs-comment"># Replaces every :<key> with value.</span> |
1596 | 1596 | <conn>.executemany(<span class="hljs-string">'<query>'</span>, <coll_of_coll>) <span class="hljs-comment"># Runs execute() multiple times.</span>
|
1597 | 1597 | </code></pre></div>
|
1598 | 1598 |
|
|
1612 | 1612 | <span class="hljs-keyword">from</span> sqlalchemy <span class="hljs-keyword">import</span> create_engine, text
|
1613 | 1613 | <engine> = create_engine(<span class="hljs-string">'<url>'</span>) <span class="hljs-comment"># Url: 'dialect://user:password@host/dbname'.</span>
|
1614 | 1614 | <conn> = <engine>.connect() <span class="hljs-comment"># Creates a connection. Also <conn>.close().</span>
|
1615 |
| -<cursor> = <conn>.execute(text(<span class="hljs-string">'<query>'</span>), …) <span class="hljs-comment"># `<dict>`. Replaces ':<key>'s with values.</span> |
| 1615 | +<cursor> = <conn>.execute(text(<span class="hljs-string">'<query>'</span>), …) <span class="hljs-comment"># `<dict>`. Replaces every :<key> with value.</span> |
1616 | 1616 | <span class="hljs-keyword">with</span> <conn>.begin(): ... <span class="hljs-comment"># Exits the block with commit or rollback.</span>
|
1617 | 1617 | </code></pre></div>
|
1618 | 1618 |
|
@@ -2496,7 +2496,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
|
2496 | 2496 | rect(<Surf>, color, <Rect>, width=<span class="hljs-number">0</span>) <span class="hljs-comment"># Also polygon(<Surf>, color, points, width=0).</span>
|
2497 | 2497 | </code></pre>
|
2498 | 2498 | <pre><code class="python language-python hljs"><Font> = pg.font.Font(<path/file>, size) <span class="hljs-comment"># Loads TTF file. Pass None for default font.</span>
|
2499 |
| -<Surf> = <Font>.render(text, antialias, color) <span class="hljs-comment"># Background color can be specified at the end.</span> |
| 2499 | +<Surf> = <Font>.render(text, antialias, color) <span class="hljs-comment"># Accepts background color as fourth argument.</span> |
2500 | 2500 | </code></pre>
|
2501 | 2501 | <div><h3 id="sound">Sound</h3><pre><code class="python language-python hljs"><Sound> = pg.mixer.Sound(<path/file/bytes>) <span class="hljs-comment"># WAV file or bytes/array of signed shorts.</span>
|
2502 | 2502 | <Sound>.play/stop() <span class="hljs-comment"># Also set_volume(<float>) and fadeout(msec).</span>
|
@@ -2940,7 +2940,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
|
2940 | 2940 |
|
2941 | 2941 |
|
2942 | 2942 | <footer>
|
2943 |
| - <aside>May 8, 2025</aside> |
| 2943 | + <aside>May 9, 2025</aside> |
2944 | 2944 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a>
|
2945 | 2945 | </footer>
|
2946 | 2946 |
|
|
0 commit comments