import time import random from ppl import pb total = 120 tasks = ["Making paintball", "Finding dragons", "Taking out the trash"] print('With iter_name') for task in tasks: i = 0 for i in pb(range(total), task=task): sleep_time = [.05, .04, .03, .02, .01][random.randint(0, 4)] time.sleep(sleep_time) # emulating long-playing task print('\nWithout iter_name') for task in tasks: i = 0 for i in pb(range(total), task=task, iter_name=None): sleep_time = [.05, .04, .03, .02, .01][random.randint(0, 4)] time.sleep(sleep_time) # emulating long-playing task
import time import random from ppl import pb total = 120 tasks = [ 'Making paintball', 'Finding dragons', 'Taking out the trash', 'Filling up water bottles for trip' ] for task in tasks: i = 0 for i in pb(range(total), task=task, mini=True): sleep_time = [.05, .04, .03, .02, .01][random.randint(0, 4)] time.sleep(sleep_time) # emulating long-playing task
import time from ppl import pb def square(nums): for i in nums: yield (i * i) tasks = ["Mapping points", "Painting rainbow white"] counts = [100, 400, 100, 50] times = [.01, .01, .03, .05] print("With iter_name") for x in zip(tasks, counts, times): for i in pb(square(range(x[1])), task=x[0]): time.sleep(x[2]) print("\nWithout iter_name") for x in zip(tasks, counts, times): for i in pb(square(range(x[1])), task=x[0], iter_name=None): time.sleep(x[2])
import time import random from ppl import pb total = 120 tasks = [ 'Make paintball', 'Find dragons', 'Code in python', 'Take out the trash', 'Fill up water bottles for trip' ] for task in tasks: i = 0 for i in pb(range(total), task=task): sleep_time = [.05, .04, .03, .02, .01][random.randint(0, 4)] time.sleep(sleep_time) # emulating long-playing task
import time from ppl import pb for i in pb(range(100), bar_len=20): time.sleep(0.1)
import time from ppl import pb for i in pb(range(100)): time.sleep(0.1)
import time from ppl import pb def square(nums): for i in nums: yield (i * i) tasks = ["Mapping points", "Painting rainbow white"] counts = [100, 400, 100, 50] times = [.01, .01, .03, .05] print("With iter_name") for x in zip(tasks, counts, times): for i in pb(square(range(x[1])), task=x[0], mini=True): time.sleep(x[2]) print("\nWithout iter_name") for x in zip(tasks, counts, times): for i in pb(square(range(x[1])), task=x[0], mini=True, iter_name=None): time.sleep(x[2])