Новый перевод английской версии сайта
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
### Working with ProgressBarManager
|
||||
|
||||
The class creates a progress bar for better visibility of code execution. It takes five arguments:
|
||||
The class creates a progress bar to display the execution process of code. It accepts five arguments:
|
||||
|
||||
1. **max**: a required parameter that indicates the maximum number of iterations in the progress bar.
|
||||
- **max**: a mandatory parameter that indicates the maximum number of iterations in the progress bar.
|
||||
|
||||
2. **message**: a message displayed before the progress bar.
|
||||
- **message**: a message displayed before the progress bar.
|
||||
|
||||
3. **color**: the color of the progress bar.
|
||||
- **color**: the color of the progress bar.
|
||||
|
||||
4. **fill**: a character used to fill the completed portion.
|
||||
- **fill**: a character used to fill the completed part.
|
||||
|
||||
5. **width**: the size of the progress bar in characters.
|
||||
- **width**: the width of the progress bar in characters.
|
||||
|
||||
```py
|
||||
|
||||
from ipars import ProgressBarManager
|
||||
|
||||
bar = ProgressBarManager(100) # Here max is set to 100
|
||||
@@ -21,11 +20,11 @@ bar = ProgressBarManager(100) # Here max is set to 100
|
||||
|
||||
### Brief Overview of ProgressBarManager Methods
|
||||
|
||||
1. The **next** method starts the next iteration of the progress bar.
|
||||
- The **next** method starts the next iteration of the progress bar.
|
||||
|
||||
2. The **finish** method completes the progress bar.
|
||||
- The **finish** method completes the progress bar.
|
||||
|
||||
### Example of Using ProgressBarManager
|
||||
### Example Usage of ProgressBarManager
|
||||
|
||||
```py
|
||||
# Importing libraries
|
||||
@@ -33,34 +32,31 @@ from ipars import ProgressBarManager
|
||||
from time import sleep
|
||||
|
||||
maxValue = 300
|
||||
|
||||
# Creating a default progress bar
|
||||
bar = ProgressBarManager(maxValue)
|
||||
|
||||
# Simulating work
|
||||
for _ in range(maxValue // 2):
|
||||
sleep(0.1)
|
||||
bar.next()
|
||||
for _ in range(maxValue//2):
|
||||
sleep(0.1)
|
||||
bar.next()
|
||||
|
||||
# Turning off the progress bar
|
||||
bar.finish()
|
||||
|
||||
# Creating a more customized progress bar
|
||||
bar = ProgressBarManager(
|
||||
maxValue,
|
||||
message='Downloading process',
|
||||
color='red',
|
||||
fill='\*',
|
||||
width=50
|
||||
maxValue,
|
||||
message='Downloading process',
|
||||
color='red',
|
||||
fill='*',
|
||||
width=50
|
||||
)
|
||||
|
||||
# Simulating work
|
||||
|
||||
for _ in range(maxValue):
|
||||
sleep(0.1)
|
||||
bar.next()
|
||||
sleep(0.1)
|
||||
bar.next()
|
||||
|
||||
# Turning off the progress bar
|
||||
|
||||
bar.finish()
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user