You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+58-56Lines changed: 58 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,33 @@
6
6
7
7
## About
8
8
9
-
- Useful for small intermittant pauses between console text returns, or code actions.
9
+
- Useful for small intermittent pauses between console text returns, or code actions.
10
10
11
-
- Customizable/optional loading and completion messages available to print to console (stdout).
11
+
- Customizable/optional loading and completion messages are available to print to the console (stdout).
12
12
13
-
- Loading message defaults to `"Loading..."`.
14
-
- Completion message defaults to `"Done!"`.
13
+
- Messages can be customized by passing custom strings to the `msg_loading: str` and `msg_complete: str` parameters respectively.
15
14
16
-
- Includes an _optional_ progress meter (simply change the `enable_display: bool` parameter to `False` if you wish to disable the progress meter), toggled on by default.
15
+
- The sequence loading message defaults to `"Loading..."`
16
+
- The sequence completion message defaults to `"Done!"`
17
+
18
+
- You may apply a label to the progress bar using the `label: str` parameter (defaults to `None`).
19
+
20
+
-`enable_display: bool` must be set to `True` for a label to be assigned to the progress bar.
21
+
22
+
- The time taken to complete each iteration can be determined using the `min_iter: float` and `max_iter: float` parameters.
23
+
24
+
- Each iteration length is randomized to a value between `min_iter: float` and `max_iter: float` seconds.
25
+
- e.g. `start(min_iter=0.5, max_iter=1.5)` would take anywhere between 0.5 - 1.5 seconds to complete a single iteration.
26
+
27
+
- Users can choose between two different loading sequences:
28
+
**A.** Progress-bar style loading sequence
29
+
**B.** Animated-text style loading sequence
30
+
31
+
- If `enable_display: bool` is `False, the progress-bar-based sequence will not be used, and the animated text-based loading sequence will be used instead.
32
+
33
+
- The desired loading sequence **can be toggled** using the `enable_display: bool` parameter.
34
+
35
+
- The text-based loading sequence displays the loading message followed by incrementing dots, all printed to the same line
17
36
18
37
---
19
38
@@ -37,84 +56,67 @@
37
56
38
57
> _Not_ recommended.
39
58
40
-
1. Download source code `.zip` archive from the PyLoadBar GitHub [releases](https://github.com/schlopp96/PyLoadBar/releases/latest) page and extract contents to desired location.
59
+
**1a.** Download the latest source code `.zip` archive from the PyLoadBar GitHub [releases](https://github.com/schlopp96/PyLoadBar/releases/latest) page and extract contents to the desired location.
41
60
42
-
- OR:
61
+
-**OR:**
43
62
44
-
1. Clone repository with the git client of your preference with:
63
+
**1b.** Clone repository with the git client of your preference with:
45
64
46
-
-`gh repo clone schlopp96/PyLoadBar`
65
+
```shell
66
+
gh repo clone schlopp96/PyLoadBar
67
+
```
47
68
48
-
2. Navigate to directory containing extracted contents, and open said folder within a terminal.
69
+
**2.** Navigate to the directory containing extracted contents, and open said folder within a terminal.
49
70
50
-
3. Enter `pip install -r requirements.txt` to install all dependencies for this package.
71
+
**3.** Enter `pip install -r requirements.txt` to install all dependencies for this package.
51
72
52
-
4. Finally, move the `"PyLoadBar-vx.x.x"` directory to your global Python 3rd-party package installation directory to be able to import `PyLoadBar` like any other module:
73
+
**4.** Finally, move the `"PyLoadBar-Vx.x.x"` directory to your global Python 3rd-party package installation directory to be able to import `PyLoadBar` like any other module:
53
74
54
-
-`"~Python/Lib/site-packages/HERE"`
75
+
-`"~Python/Lib/site-packages/HERE"`
55
76
56
-
5. Done!
77
+
**5.** Done!
57
78
58
79
---
59
80
60
81
## Usage
61
82
62
-
- Within a `.py` project, simply import the `PyLoadBar` module to start using your custom loading sequence.
63
-
64
83
-`PyLoadBar` is _very_ simple to use.
65
84
66
-
- For example, try running the following:
67
-
68
-
```python
69
-
>>>from PyLoadBar import PyLoadBar
70
-
71
-
>>> bar = PyLoadBar() # Initialize a new `PyLoadBar` instance.
72
-
73
-
>>>defadd50(x):
74
-
bar.load(msg_loading='Adding 50 to x', msg_complete='Okay!', time=30, label='Solving', enable_display=True) # Call `load` method to start loading sequence.
- Within a `.py` project, simply import the `PyLoadBar` module to start using your custom loading sequence.
86
86
87
-
Okay!
87
+
- Example of standard loading sequence with `label` set to `'Solving'`:
88
88
89
-
100
90
-
```
89
+
```python
90
+
>>>from PyLoadBar import PyLoadBar
91
91
92
-
- The **_loading_** and **_loading complete_** messages can be customized by passing custom strings to the `msg_loading: str` and `msg_complete: str` parameters respectively.
92
+
>>> important_bar = PyLoadBar(msg_loading='Important Stuff Happening', msg_complete='Day Saved!', label='Saving Day') # Initialize a new `PyLoadBar` instance.
93
93
94
-
- Note that the progress bar **can be toggled** using the `enable_display: bool` parameter.
- If you wish to help contribute to this project, please run the following in your virtual env to acquire the necessary dependencies and tools you need to develop and run tests:
0 commit comments