27 lines
793 B
Python
27 lines
793 B
Python
import time
|
|
import os
|
|
import sys
|
|
|
|
def status_bar():
|
|
try:
|
|
while True:
|
|
# Obtenir la taille du terminal
|
|
rows, columns = os.popen('stty size', 'r').read().split()
|
|
rows = int(rows)
|
|
columns = int(columns)
|
|
|
|
# Déplacer le curseur au début du terminal
|
|
sys.stdout.write("\033[H") # Aller au coin supérieur gauche
|
|
sys.stdout.write("\033[2K") # Effacer la ligne
|
|
sys.stdout.write("Status Bar: [Working on tasks...] | Time: {}\n".format(time.strftime("%H:%M:%S")))
|
|
sys.stdout.flush()
|
|
|
|
# Attendre un peu avant de mettre à jour
|
|
time.sleep(1)
|
|
|
|
except KeyboardInterrupt:
|
|
print("\nExiting status bar...")
|
|
|
|
if __name__ == "__main__":
|
|
status_bar()
|