File: spinner_demo.py

package info (click to toggle)
python-consolekit 1.7.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,152 kB
  • sloc: python: 2,835; makefile: 8
file content (24 lines) | stat: -rw-r--r-- 488 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Demo of consolekit's spinners

# stdlib
import time

# this package
from consolekit.utils import braille_spinner, hidden_cursor, snake_spinner, solidus_spinner

REPEATS = 50
SLEEP = 0.5

with hidden_cursor():

	for _ in range(REPEATS):
		print(f"\r{next(braille_spinner)}", end='')
		time.sleep(SLEEP)

	for _ in range(REPEATS):
		print(f"\r{next(solidus_spinner)}", end='')
		time.sleep(SLEEP)

	for _ in range(REPEATS):
		print(f"\r{next(snake_spinner)}", end='')
		time.sleep(SLEEP)