buffer is now not used with default parameters of TextIOConsoleWrapper

This commit is contained in:
devfred78
2022-02-19 16:30:37 +01:00
parent 2a2fe6fa01
commit 52b5bd68e9
2 changed files with 18 additions and 8 deletions

View File

@@ -81,7 +81,7 @@ Those lines initalize a full HD, fullscreen display, with a background image nam
Initialize an I/O text, buffered stream with:
```python
iotextstream = pygconsole.io.TextIOConsoleWrapper(console_name="pygame_console", newline='\r\n', line_buffering=True)
iotextstream = pygconsole.io.TextIOConsoleWrapper(console_name="pygame_console")
```
Retrieve the console created "under the hoods" with this I/O stream:
@@ -106,9 +106,9 @@ while True:
if event.key == K_ESCAPE:
sys.exit() # Exit when hitting the ESCAPE key
elif event.key == K_RETURN:
print("", file=iotextstream, flush=True) # New line
print("", file=iotextstream) # New line
if event.type == TEXTINPUT: # When typing a key with a writable character...
print(event.text, end='', file=iotextstream, flush=True) # Display the character
print(event.text, end='', file=iotextstream) # Display the character
# Background display
screen_surface.blit(background_surface,(0,0))
@@ -125,7 +125,7 @@ If you wish to custom the console, you can initialize it independantly, and assi
```python
my_console = pygconsole.console.get_console(name="custom_console",width=120,height=50)
iotextstream = pygconsole.io.TextIOConsoleWrapper(console_name="custom_console", newline='\r\n', line_buffering=True)
iotextstream = pygconsole.io.TextIOConsoleWrapper(console_name="custom_console")
```
A console is identified by its name, 2 consoles with the same name are in reality the same instance of the Console class.