|
| 1 | +# Welcome to the TbProgressLib documentation! |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +### The ultimate taskbar progress python package! |
| 6 | + |
| 7 | +## index |
| 8 | +Quick Start: |
| 9 | + [installation](#installation) |
| 10 | + [example](#example) |
| 11 | + |
| 12 | +API Docs: [The main object](#main_object) |
| 13 | + |
| 14 | +## **installation** |
| 15 | + |
| 16 | +Unfortunately, I did not upload this to Pypi, so you cannot install it with pip. |
| 17 | + |
| 18 | +To install: |
| 19 | + |
| 20 | +1.Download or clone this repository. |
| 21 | + |
| 22 | +2.If you have downloaded it, unzip the downloaded file. |
| 23 | + |
| 24 | +3.Go to file explorer and get to the directory where you have cloned or unzipped the repository. |
| 25 | + |
| 26 | +4.type 'cmd' in the place where you see the path. |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +5.hit enter. |
| 31 | + |
| 32 | +6.type 'python install.py' and hit enter (If you have python on your PATH variable. If not, add it.) |
| 33 | + |
| 34 | +7.copy 'TaskbarLib.tlb' to your project directory. |
| 35 | + |
| 36 | +8.Try out the example now! |
| 37 | + |
| 38 | +##### [back to top](#index) |
| 39 | +##### [API docs](#main_object) |
| 40 | + |
| 41 | +## example: |
| 42 | + |
| 43 | + import time |
| 44 | + import tbprog |
| 45 | + |
| 46 | + prog = tbprog.Progress() |
| 47 | + prog.init() |
| 48 | + |
| 49 | + prog.setState('loading') |
| 50 | + time.sleep(5) |
| 51 | + |
| 52 | + prog.setState('normal') |
| 53 | + |
| 54 | + for i in range(100): |
| 55 | + prog.setProgress(i) |
| 56 | + time.sleep(0.05) |
| 57 | + prog.setProgress(0) |
| 58 | + |
| 59 | + prog.setState('warning') |
| 60 | + |
| 61 | + for i in range(100): |
| 62 | + prog.setProgress(i) |
| 63 | + time.sleep(0.05) |
| 64 | + |
| 65 | + prog.setProgress(0) |
| 66 | + prog.setState('error') |
| 67 | + |
| 68 | + for i in range(100): |
| 69 | + prog.setProgress(i) |
| 70 | + time.sleep(0.05) |
| 71 | + |
| 72 | + prog.setProgress(0) |
| 73 | + |
| 74 | + prog.setState('done') |
| 75 | + while True: |
| 76 | + time.sleep(1) |
| 77 | + print('close me!') |
| 78 | + |
| 79 | +##### [back to top](#index) |
| 80 | +##### [API docs](#main_object) |
| 81 | + |
| 82 | +### _______________________________________________________ |
| 83 | +## main_object |
| 84 | +#### the main object: |
| 85 | +##### _+ TaskbarProgress() |
| 86 | +##### _____+ functions |
| 87 | +##### _________+ __init__(hwnd=hWnd) (called when you create the object, if hwnd is not given,this will automatically take the hwnd of the cmd window.) |
| 88 | +##### _________+ init() (initialise the object to display progress) |
| 89 | +##### _________+ setState(value:string) (one of normal,warning,error,loading or done) [more](#setState) |
| 90 | +##### _________+ setProgress(value:int,max=100) (set taskbar progress value) [more](#setProgress) |
| 91 | +##### [back to top](#index) |
| 92 | + |
| 93 | +## setState |
| 94 | +##### _+ the main function: TaskbarProgress.setState |
| 95 | + |
| 96 | +###### _____+ setState(value) |
| 97 | +###### _________+ value: string (one of normal,warning,error,loading or done) |
| 98 | +###### _________+ usage example: |
| 99 | +##### [back to top](#index) |
| 100 | +##### [back to API docs](#main_object) |
| 101 | + |
| 102 | + import tbprog |
| 103 | + import time |
| 104 | + |
| 105 | + progress = Progress() |
| 106 | + progress.init() |
| 107 | + |
| 108 | + #taskbar icon becoms green, or starts to display a loading animation |
| 109 | + progress.setState('loading') |
| 110 | + time.sleep(5) |
| 111 | + |
| 112 | + #progress becomes yellow |
| 113 | + progress.setState('warning') |
| 114 | + time.sleep(5) |
| 115 | + |
| 116 | + #progress becomes red |
| 117 | + progress.setState('error') |
| 118 | + time.sleep(5) |
| 119 | + |
| 120 | + #taskbar icon is normal again! |
| 121 | + progress.setState('normal') |
| 122 | + |
| 123 | +## setProgress |
| 124 | +##### _+ the main function: TaskbarProgress.setProgress |
| 125 | + |
| 126 | +###### _____+ setProgress(value,max) |
| 127 | +###### _________+ value: integer (set the numerator of the taskbar progress value) |
| 128 | +###### _________+ value: integer (set the denominator of the taskbar progress value) |
| 129 | +###### _________+ usage example: |
| 130 | +##### [back to top](#index) |
| 131 | +##### [back to API docs](#main_object) |
| 132 | + |
| 133 | + import tbprog |
| 134 | + import time |
| 135 | + |
| 136 | + progress = Progress() |
| 137 | + progress.init() |
| 138 | + |
| 139 | + for i in range(100): |
| 140 | + progress.setProgress(i,100) |
| 141 | + |
| 142 | +### Happy Coding! |
0 commit comments