Coder Social home page Coder Social logo

yasserbdj96 / timeloading Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 205 KB

Animated loading bar. This package is a loading bar that appears when a specific function is run an animation and text. This bar is stoped to run after the function has finished working. You can control the shape and the waiting message, even the animation and its colors.

License: Other

Python 92.06% Dockerfile 7.94%

timeloading's Introduction

timeloading

Animated loading bar. This package is a loading bar that appears when a specific function is run an animation and text. This bar is stoped to run after the function has finished working. You can control the shape and the waiting message, even the animation and its colors.

Python package Docker image CodeFactor

Languages:

* python3

Supported Distributions:

Distribution Version Check Python Test Version Supported Status Everything works
Ubuntu 20.04.3 3.6, 3.7, 3.8, 3.9 Yes Working Yes
Windwos 11.6.4 3.6, 3.7, 3.8, 3.9 Yes Working Yes
MacOS 10.0.20348 3.6, 3.7, 3.8, 3.9 Yes Working Yes

Installation:

pip install timeloading

Usage:

from timeloading import *

# Default usage:
exec(timeloading().loading(function))

# In-depth use:
exec(timeloading(animation,time_w).loading(function,args,msg,done))

"""
Help:
# animation : ascii animation text list. ex: ["⢿","⣻","⣽","⣾","⣷","⣯","⣟","⡿"] OR "⢿⣻⣽⣾⣷⣯⣟⡿"
# time_w : Transition time between animations.
# function : The function name must be a string.
# args : Function variables. ex: (var_name,) OR [var_name]
# msg : Waiting message text.
# done : Message after completion.
"""

Examples:

from timeloading import *

# func1:
def func1():
    time.sleep(3)

# func2:
def func2(x):
    time.sleep(x)

# example-1:
# Run the wait function "func1" for 3 seconds with default settings.
exec(timeloading().loading(function="func1")) # You can run the code directly without using exec() and write the code that returns directly from the function.

# example-2:
# Run the wait function "func2" for 5 seconds and change the message settings.
exec(timeloading().loading(function="func2",args=[5],msg="Loading....",done="ok"))

# example-3:
# The same as the previous example, but with a change in the speed and shape of the animation.
exec(timeloading(animation=["[*  ]","[ * ]","[  *]","[ * ]",],time_w=0.1).loading(function="func2",args=[5],msg="Loading....",done="ok"))

# example-4:
# Example with color
from hexor import * # pip install hexor

p1=hexor(True,"hex")
s0=p1.c("*","#ff0000")
s1=p1.c("*","#760e0e")
s2=p1.c("*","#ff7272")

l=[f"[{s0}{s1}{s2}]",f"[{s1}{s2}{s0}]",f"[{s2}{s0}{s1}]"]
exec(timeloading(animation=l,time_w=0.1).loading(function="func2",args=[5],msg="Loading....",done="ok"))

Screenshot:

Changelog History:

## 0.0.1 [13-03-2022]
- First public release.

timeloading's People

Contributors

imgbotapp avatar yasserbdj96 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.