ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

`ipywidgets.Output` always add newline to `print`, even when asked not to.

Open lgautier opened this issue 6 months ago • 0 comments
trafficstars

Description

The Python function print() accepts a parameter end to specify what to add at the end of the print. The default is the new line character but this can be changed.

Reproduce

import ipywidgets
output = ipywidgets.Output()
display(output)

for i in range(10):
  with output:
    print(i, end=', ', flush=True)

Expected behavior

Printing on the same line as achieved when Output is not involved:

for i in range(10):
  print(i, end=', ', flush=True)

Context

  • ipywidgets version 7.7.1
  • Operating System and version: Colab
  • Browser and version: Firefox

lgautier avatar Apr 30 '25 15:04 lgautier