-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path#BasicCalculator.py
More file actions
40 lines (34 loc) · 1.02 KB
/
#BasicCalculator.py
File metadata and controls
40 lines (34 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#BasicCalculator
#importing stuff
import math
import time
import keyboard
from time import sleep
import datetime
import os
import subprocess
import webbrowser
#done importing stuff
now = datetime.datetime.now()
now
#more time stuff
def openspotifyweb():
spotifyurl = "https://open.spotify.com/"
firefox_path = "/usr/bin/firefox"
webbrowser.register('firefox', None, webbrowser.BackgroundBrowser(firefox_path))
webbrowser.get('firefox').open(spotifyurl)
print("Select a key #E for opening spotify , esc for exiting")
while True: # making a loop
try: # used try so that if user pressed other than the given key error will not be shown
# print("Select a key") if needed
if keyboard.is_pressed('e'):
openspotifyweb()
break
elif keyboard.is_pressed('esc'):
#idk
print(f"esc just pressed exiting program {now}")
sleep(1)
break
except Exception as k:
print(f"idk {k}")
break