From ba2dde64e802d4ad1077e6b05d23eaa1feb833ff Mon Sep 17 00:00:00 2001 From: Harshavardhan Bajoria <62978274+HVbajoria@users.noreply.github.com> Date: Mon, 3 Oct 2022 19:52:29 +0530 Subject: [PATCH 1/3] Create README.md --- scripts/Fidget spinner/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 scripts/Fidget spinner/README.md diff --git a/scripts/Fidget spinner/README.md b/scripts/Fidget spinner/README.md new file mode 100644 index 0000000..ae3f15e --- /dev/null +++ b/scripts/Fidget spinner/README.md @@ -0,0 +1,13 @@ +# Fidget Spinner With Python +This is a fidget spinner simulator made using Python which can help you release nervous energy, anxiety and stay calm. + +## How to install? +1) Donwload the file fidgetspinner.py +2) Open CMD (Command Prompt) +3) Run python fidgetspinner.py +4) Press the spacebar 5-6 times and see it accelarting with the press. + +## Requirements? +None! + +Hope you enjoy it! ❤️ From 55d965dc7ca47f23869fc89c0fee8eb93a6f730c Mon Sep 17 00:00:00 2001 From: Harshavardhan Bajoria <62978274+HVbajoria@users.noreply.github.com> Date: Mon, 3 Oct 2022 19:52:59 +0530 Subject: [PATCH 2/3] Added Code --- scripts/Fidget spinner/fidgetspinner.py | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 scripts/Fidget spinner/fidgetspinner.py diff --git a/scripts/Fidget spinner/fidgetspinner.py b/scripts/Fidget spinner/fidgetspinner.py new file mode 100644 index 0000000..f6851c6 --- /dev/null +++ b/scripts/Fidget spinner/fidgetspinner.py @@ -0,0 +1,52 @@ +#Import libraries and modules +from turtle import * + +state = {'turn': 0} + +# Function to spin the fidget +def spinner(): + clear() + angle = state['turn']/8 + right(angle) + forward(100) + # Declare first dot + dot(200, 'teal') + back(100) + right(120) + forward(100) + # Declare second dot + dot(200, 'peach puff') + back(100) + right(120) + forward(100) + # Declare third dot + dot(200, 'navy') + back(100) + right(120) + update() + +# Function that slows down the widget with time and spins it +def animate(): + if state['turn']>0: + state['turn']-=1 + + spinner() + ontimer(animate, 20) + +# Flick the fidget based on number of clicks +def flick(): + state['turn']+=12 + +# Define window size +setup(520, 520, 370, 0) + +hideturtle() +tracer(False) +width(20) + +# Call the function with clicks on spacebar +onkey(flick, 'space') +listen() +animate() +done() + From 2805b83f9ab91561ef62f1dbfba868aa04dd04a6 Mon Sep 17 00:00:00 2001 From: Harshavardhan Bajoria <62978274+HVbajoria@users.noreply.github.com> Date: Mon, 3 Oct 2022 19:59:40 +0530 Subject: [PATCH 3/3] Update README.md --- scripts/Fidget spinner/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/Fidget spinner/README.md b/scripts/Fidget spinner/README.md index ae3f15e..1e1e48a 100644 --- a/scripts/Fidget spinner/README.md +++ b/scripts/Fidget spinner/README.md @@ -1,11 +1,11 @@ # Fidget Spinner With Python -This is a fidget spinner simulator made using Python which can help you release nervous energy, anxiety and stay calm. +This is a fidget spinner simulator made using Python which can help you release nervous energy, and anxiety and stay calm. ## How to install? -1) Donwload the file fidgetspinner.py +1) Download the file fidgetspinner.py 2) Open CMD (Command Prompt) 3) Run python fidgetspinner.py -4) Press the spacebar 5-6 times and see it accelarting with the press. +4) Press the spacebar 5-6 times and see it accelerating with the press. ## Requirements? None!