Skip to content

Commit 9d3abbe

Browse files
committed
Fix nonclearing output when nothing is outputed
When the the update does not print anything the output is not cleared, since it waits for an output to be cleared. We fix this by printing an empty string to invoke the clearning of the output
1 parent 7519ac6 commit 9d3abbe

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/scwidgets/exercise/_widget_code_exercise.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,11 @@ def _on_click_update_action(self) -> bool:
657657
raised_error = True
658658
raise e
659659

660+
# The clear_output command at the beginning of the function waits till
661+
# something is printed. If nothing is printed it, it is not cleared. We
662+
# enforce it to be invoked by printing an empty string
663+
print('', end='')
664+
660665
return not (raised_error)
661666

662667
def run_update(self):

0 commit comments

Comments
 (0)