pollev / python_progress_bar Goto Github PK
View Code? Open in Web Editor NEWAPT like progress bar
License: MIT License
APT like progress bar
License: MIT License
Hi there, is the package available on pypi? If so can you please add a link to the README for that.
It looks great btw!
Can you please add Windows support for this package?
The progress bar and logging compete to write on the screen causing something like this:
It might be difficult to fix this though. Any ideas?
Note: I had modified your code to test with logging. The modified script is:
#!/usr/bin/env python3
import random
import string
import time
import logging
# Import the progress bar
from python_progress_bar import progress_bar
LOGGER = logging.getLogger(__name__)
def random_string(string_length=30):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(string_length))
def generate_some_output_and_sleep():
LOGGER.error("Here is some output")
LOGGER.error(random_string())
LOGGER.error(random_string())
LOGGER.error(random_string())
LOGGER.error(random_string())
LOGGER.error(
"\n\n------------------------------------------------------------------"
)
LOGGER.error("\n\n Now sleeping briefly")
time.sleep(0.3)
def main():
# Make sure that the progress bar is cleaned up when user presses ctrl+c
progress_bar.enable_trapping()
# Create progress bar
progress_bar.setup_scroll_area()
for i in range(99):
if i == 50:
LOGGER.error("waiting for user input: ")
progress_bar.block_progress_bar(i)
input("User input: ")
else:
generate_some_output_and_sleep()
progress_bar.draw_progress_bar(i)
progress_bar.destroy_scroll_area()
main()
The bar is placed under the terminal, only a tiny portion is visible. I'm a Linux Mint Tina 19.2, and had no such issues with the bash version, built-int terminal with zsh (tested without as well)
Even when nothing is printed and we use an empty for loop, the cursor keeps pushing "down" with each iteration.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.