-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
43 lines (29 loc) · 1002 Bytes
/
utils.py
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
41
42
43
import webbrowser
import winsound
def open_github():
"""
Open the GitHub repository for the PySweeper project.
"""
github_url = "https://github.com/georgescutelnicu/PySweeper"
webbrowser.open(github_url)
def open_rules():
"""
Open the rules for PySweeper.
"""
rules_url = "https://github.com/georgescutelnicu/PySweeper/tree/main/rules"
webbrowser.open(rules_url)
def play_sound(sound_path):
"""
Play a sound file.
Parameters:
- sound_path (str): The path to the sound file.
"""
winsound.PlaySound(sound_path, winsound.SND_FILENAME | winsound.SND_ASYNC)
def toggle_sound(board):
"""
Toggle the sound setting between ON and OFF.
Parameters:
- board (Board): The instance of the Board class where the sound setting should be toggled.
"""
board.sound = "OFF" if board.sound == "ON" else "ON"
board.settings_menu.entryconfig(1, label=f"Sound {board.sound}")