You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to create function to streaming from incoming text using both rich.markdown and rich.live. In this example, I use simple number loop with the delay to simulate the streaming. Here's the simple example:
import time
from rich.markdown import Markdown
from rich.live import Live
def stream_numbers(chunk_size=1):
for i in range(1, 11, chunk_size):
yield f"\n\n{i}"
time.sleep(0.01)
render_this = ""
with Live(render_this, auto_refresh=False, vertical_overflow="visible") as live:
print(f"Console height: {live.console.height}")
for entry in stream_numbers():
render_this += entry
live.update(Markdown(render_this), refresh=True)
Result:
1
1
(newline)
[...]
(newline)
10
Expected result:
Output scrolling after excess console.height,
1
(newline)
[...]
(newline)
10
Result only breaking (duplicating) only when loop are above console.height. In this example, my console height are 18, and I try to print above it (19 newline).
Platform
Click to expand
Windows 11 with Python 3.10, Trying in: VSCode Terminal, Windows Terminal, and Cmder
Describe the bug
I try to create function to streaming from incoming text using both rich.markdown and rich.live. In this example, I use simple number loop with the delay to simulate the streaming. Here's the simple example:
Result:
Expected result:
Output scrolling after excess console.height,
Result only breaking (duplicating) only when loop are above console.height. In this example, my console height are 18, and I try to print above it (19 newline).
Platform
Click to expand
Windows 11 with Python 3.10, Trying in: VSCode Terminal, Windows Terminal, and Cmder
The text was updated successfully, but these errors were encountered: