Ejemplo n.º 1
0
with yaspin(Spinners.noise, text="Noise spinner") as sp:
    time.sleep(2)

    sp.spinner = Spinners.arc  # spinner type
    sp.text = "Arc spinner"  # text along with spinner
    sp.color = "yellow"  # spinner color
    sp.side = "right"  # put spinner to the right
    sp.reversal = True

    time.sleep(2)

# + [markdown] nteract={"transient": {"deleting": false}}
# ### Writing messages
# You should not write any message in the terminal using print while spinner
# is open. To write messages in the terminal without any collision with yaspin
# spinner, a ``.write()`` method is provided:
#

# + jupyter={"source_hidden": false, "outputs_hidden": false} nteract={"transient": {"deleting": false}}
with yaspin(text="Downloading images", color="cyan") as sp:
    # task 1
    time.sleep(2)
    sp.write("> image 1 download complete")

    # task 2
    time.sleep(2)
    sp.write("> image 2 download complete")

    # finalize
    sp.ok("")
Ejemplo n.º 2
0
def ok(spinner: yaspin.Spinner) -> None:
    spinner.ok("✅ ")