From bbde7a70b58ff97b8706e3734794fee4bf346737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Mon, 4 Oct 2021 04:31:29 +0200 Subject: [PATCH] Format, Pygame --- README.md | 8 +++++--- index.html | 14 ++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 57bbf57..7c213e3 100644 --- a/README.md +++ b/README.md @@ -412,18 +412,20 @@ Format {:.<10} # '......' {:0} # '' ``` -* **Use `'{:{}[...]}'` to set options dynamically.** +* **Options can be generated dynamically: `f'{:{}[…]}'`.** * **Adding `'!r'` before the colon converts object to string by calling its [repr()](#class) method.** ### Strings ```python -{'abcde'!r:10} # "'abcde' " +{'abcde':10} # 'abcde ' {'abcde':10.3} # 'abc ' {'abcde':.3} # 'abc' +{'abcde'!r:10} # "'abcde' " ``` ### Numbers ```python +{ 123456:10} # ' 123456' { 123456:10,} # ' 123,456' { 123456:10_} # ' 123_456' { 123456:+10} # ' +123456' @@ -2950,7 +2952,7 @@ while all(event.type != pg.QUIT for event in pg.event.get()): **Object for representing images.** ```python = pg.display.set_mode((width, height)) # Returns display surface. - = pg.Surface((width, height), …) # New RGB surface. Add `pg.SRCALPHA` for RGBA. + = pg.Surface((width, height) [, flags]) # New RGB surface. RGBA if `flags=pg.SRCALPHA`. = pg.image.load('') # Loads the image. Format depends on source. = .subsurface() # Returns a subsurface. ``` diff --git a/index.html b/index.html index 009e5f7..1d802bb 100644 --- a/index.html +++ b/index.html @@ -226,7 +226,7 @@ pre.prettyprint {
- +
@@ -537,15 +537,17 @@ to_exclusive = <range>.stop
    -
  • Use '{<el>:{<str/int/float>}[...]}' to set options dynamically.
  • +
  • Options can be generated dynamically: f'{<el>:{<str/int>}[…]}'.
  • Adding '!r' before the colon converts object to string by calling its repr() method.
-

Strings

{'abcde'!r:10}                                 # "'abcde'   "
+

Strings

{'abcde':10}                                   # 'abcde     '
 {'abcde':10.3}                                 # 'abc       '
 {'abcde':.3}                                   # 'abc'
+{'abcde'!r:10}                                 # "'abcde'   "
 
-

Numbers

{ 123456:10,}                                  # '   123,456'
+

Numbers

{ 123456:10}                                   # '    123456'
+{ 123456:10,}                                  # '   123,456'
 { 123456:10_}                                  # '   123_456'
 { 123456:+10}                                  # '   +123456'
 {-123456:=10}                                  # '-   123456'
@@ -2538,7 +2540,7 @@ rect = pg.Rect(240, 2
 <list> = <Rect>.collidelistall(<list_of_Rect>)  # Returns indexes of all colliding Rects.
 

Surface

Object for representing images.

<Surf> = pg.display.set_mode((width, height))   # Returns display surface.
-<Surf> = pg.Surface((width, height), …)         # New RGB surface. Add `pg.SRCALPHA` for RGBA.
+<Surf> = pg.Surface((width, height) [, flags])  # New RGB surface. RGBA if `flags=pg.SRCALPHA`.
 <Surf> = pg.image.load('<path>')                # Loads the image. Format depends on source.
 <Surf> = <Surf>.subsurface(<Rect>)              # Returns a subsurface.
 
@@ -3005,7 +3007,7 @@ $ pyinstaller script.py --add-data '<path>:.'