444b / jaccuse Goto Github PK
View Code? Open in Web Editor NEWA simple python script to count the [interval] since [thing happened]
License: GNU General Public License v3.0
A simple python script to count the [interval] since [thing happened]
License: GNU General Public License v3.0
Let the user know the reset will occur
maybe even with a countdown?
Line 196 in 7e10ab5
Instead of this block:
if duration == "sec":
update_display(counter, duration)
sleep(1)
counter += 1
elif duration == "min":
update_display(counter, duration)
sleep(60)
counter += 1
elif duration == "hour":
update_display(counter, duration)
sleep(3600)
counter += 1
elif duration == "day":
update_display(counter, duration)
sleep(86400)
counter += 1
else:
print("error")
break
You can have a dictionary like:
duration_dict = {"sec":1, "minute":60, "hour":3600, "day":86400}
And then replace the block with:
if duration:
update_display(counter, duration)
sleep(duration_dict[duration])
counter += 1
else:
print("error")
break
Line 42 in 7e10ab5
if event.action == "pressed":
# Check which direction
if event.direction == "middle":
flipped = False # exits the loop
sense.set_rotation(direction_dict[event.direction])
sense.show_letter(arrow)
You could also do:
if event.direction in ["up", "down", "left", "right"]:
Need to upgrade and optimize the following functions
Instead of using if statements, we can use a dictionary
psuedocode: directionDict ={"up" : 0, "down": 180, etc}
we can set it with sense.set_rotation(directionDict[event.direction])
Currently, single digits are shown via sense.show_letter(), which can handle single letters
We can not use this when we use numbers >= 10, so we have a workaround of using sense.show_message()
we need to fix this since sense.show_message() scrolls the value past and this is problematic for any time greater than a second
Required:
Allow the script to launch on startup so that just powering on the pi is sufficient to begin the program
the program breaks when the counter goes past 99
Need to find a way to handle that. maybe error handling?
An issue is that you have to pick the time periods
A request for a new feature is to start the timer and it automatically changes the time period
if 60s, period = minute
if 60m, period = hour
if 24h, period = day
Line 97 in 7e10ab5
You can give functions decorations like:
def change(canvas:list, paint:list) -> None:
Then when you hover your mouse over change it'll show you the inputs/output types and the -> is the return type
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.