Skip to content

Latest commit

 

History

History
160 lines (109 loc) · 4.02 KB

docs.md

File metadata and controls

160 lines (109 loc) · 4.02 KB

Welcome to the TbProgressLib documentation!

The ultimate taskbar progress python package!

Index

Quick Start: installation example

API Docs: The Main Object

Contributing: Contributing guidelines

Installation

You can install PyTaskbar with:

pip install PyTaskbar

To install with wheel:

  1. Download wheel from this distribution:LINK.

  2. Do "pip install path-to-wheel.whl"

  3. Try out the example now!

To install manually:

  1. Download wheel from this distribution:LINK.

  2. Once you have downloaded it, unzip the downloaded file.

  3. Go to file explorer and get to the directory where you have cloned or unzipped the repository.

  4. type 'cmd' in the place where you see the path.

image

  1. hit enter.

  2. type 'python install.py' and hit enter.

  3. Try out the example now!

Example:

import time
import PyTaskbar

prog = PyTaskbar.Progress()
prog.init()

prog.setState('loading')
time.sleep(5)

prog.setState('normal')

for i in range(100):
    prog.setProgress(i)
    time.sleep(0.05)
prog.setProgress(0)

prog.setState('warning')

for i in range(100):
    prog.setProgress(i)
    time.sleep(0.05)

prog.setProgress(0)
prog.setState('error')

for i in range(100):
    prog.setProgress(i)
    time.sleep(0.05)

prog.setProgress(0)

prog.setState('done')
while True:
    time.sleep(1)
    print('close me!')

Main Object

the main object:

_+ TaskbarProgress()
_____+ functions
_________+ init(hwnd=hWnd) (called when you create the object, if hwnd is not given,this will automatically take the hwnd of the cmd window.)
_________+ init() (initialise the object to display progress)
_________+ setState(value:string) (one of normal,warning,error,loading or done) more
_________+ setProgress(value:int,max=100) (set taskbar progress value) more

setState

_+ the main function: TaskbarProgress.setState
_____+ setState(value)
_________+ value: string (one of normal,warning,error,loading or done)
_________+ usage example:
import PyTaskbar
import time

progress = PyTaskbar.Progress()
progress.init()

#taskbar icon becoms green, or starts to display a loading animation
progress.setState('loading')
time.sleep(5)

#progress becomes yellow
progress.setState('warning')
time.sleep(5)

#progress becomes red
progress.setState('error')
time.sleep(5)

#taskbar icon is normal again!
progress.setState('normal')

setProgress

_+ the main function: TaskbarProgress.setProgress
_____+ setProgress(value,max)
_________+ value: integer (set the numerator of the taskbar progress value)
_________+ value: integer (set the denominator of the taskbar progress value)
_________+ usage example:
import PyTaskbar
import time

progress = PyTaskbar.Progress()
progress.init()

for i in range(100):
    progress.setProgress(i,100)

Happy Coding!