Skip to main content

A print to always print in the same line, refreshing the content

Project description

A print to always print in the same line, refreshing the content

Setup

$ pip install refreshit

Code sample

Refreshing some text

from refreshit import uprint
from time import sleep

uprint("Beautiful is better than ugly.")
sleep(1)
uprint("Explicit is better than implicit.\n")
sleep(1)

Loading state

from refreshit import uprint
from time import sleep

load = ["Loading", "Loading.", "Loading..", "Loading..."]
for i in range(4):
    for item in load:
        uprint(item)
        sleep(0.2)
uprint("Complete\n")

A progress bar

from refreshit import uprint
from time import sleep

n = 20
squares = [u"\u25A0"*x+" "+"{:.0f}".format((x/(n-1))*100)+"%" for x in range(n)]
for i in range(2):
    for item in squares:
        uprint(item)
        sleep(0.1)
print()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
refreshit-0.2-py2.py3-none-any.whl (3.6 kB) Copy SHA256 hash SHA256 Wheel py2.py3
refreshit-0.2.tar.gz (3.0 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page