Skip to content

Commit

Permalink
Creating set_println_stream function
Browse files Browse the repository at this point in the history
  • Loading branch information
taconi committed Jan 6, 2025
1 parent 026dd8e commit 7ff76c3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/web/src/lib/py5-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,20 @@ def noise_detail(*args):
def noise_seed(*args):
return _P5_INSTANCE.noiseSeed(*args)
println = print
class _DefaultPrinter:
def print(self, *args, **kwargs):
builtins.print(*args, **kwargs)
_println_stream = _DefaultPrinter()
def set_println_stream(println_stream):
global _println_stream
_println_stream = println_stream
def println(*args, sep=" ", end="\\n", stderr=False):
msg = sep.join(str(x) for x in args)
_println_stream.print(msg, end=end, stderr=stderr)
np_random = np.random.default_rng()
def random_seed(seed):
Expand Down

0 comments on commit 7ff76c3

Please sign in to comment.