-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsound.py
More file actions
31 lines (23 loc) · 750 Bytes
/
sound.py
File metadata and controls
31 lines (23 loc) · 750 Bytes
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
#!/usr/bin/env python3
"""
@Filename: sound.py
@Author: dulanj
@Time: 2021-09-23 17.06
"""
import threading
from playsound import playsound
class Sound:
def __init__(self):
...
def _play(self, sound):
threading.Thread(target=playsound, args=(sound,), daemon=True).start()
def click(self):
threading.Thread(target=playsound, args=('data/sound/click.mp3',), daemon=True).start()
# self._play('data/sound/click.mp3')
def double_click(self):
threading.Thread(target=playsound, args=('data/sound/click2.mp3',), daemon=True).start()
# self._play('data/sound/double_click.wav')
if __name__ == '__main__':
sound = Sound()
sound.click()
# sound.double_click()