4 files changed +81
-1
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,27 @@ provided by Windows platforms. It includes functions and several constants.
142
142
to specify an application-defined sound alias.
143
143
144
144
145
+ .. data :: SND_SENTRY
146
+
147
+ Triggers a SoundSentry event when the sound is played.
148
+
149
+ .. versionadded :: 3.14
150
+
151
+
152
+ .. data :: SND_SYNC
153
+
154
+ The sound is played synchronously. This is the default behavior.
155
+
156
+ .. versionadded :: 3.14
157
+
158
+
159
+ .. data :: SND_SYSTEM
160
+
161
+ Assign the sound to the audio session for system notification sounds.
162
+
163
+ .. versionadded :: 3.14
164
+
165
+
145
166
.. data :: MB_ICONASTERISK
146
167
147
168
Play the ``SystemDefault `` sound.
@@ -166,3 +187,30 @@ provided by Windows platforms. It includes functions and several constants.
166
187
167
188
Play the ``SystemDefault `` sound.
168
189
190
+
191
+ .. data :: MB_ICONERROR
192
+
193
+ Play the ``SystemHand `` sound.
194
+
195
+ .. versionadded :: 3.14
196
+
197
+
198
+ .. data :: MB_ICONINFORMATION
199
+
200
+ Play the ``SystemDefault `` sound.
201
+
202
+ .. versionadded :: 3.14
203
+
204
+
205
+ .. data :: MB_ICONSTOP
206
+
207
+ Play the ``SystemHand `` sound.
208
+
209
+ .. versionadded :: 3.14
210
+
211
+
212
+ .. data :: MB_ICONWARNING
213
+
214
+ Play the ``SystemExclamation `` sound.
215
+
216
+ .. versionadded :: 3.14
Original file line number Diff line number Diff line change @@ -82,6 +82,18 @@ def test_hand(self):
82
82
def test_question (self ):
83
83
safe_MessageBeep (winsound .MB_ICONQUESTION )
84
84
85
+ def test_error (self ):
86
+ safe_MessageBeep (winsound .MB_ICONERROR )
87
+
88
+ def test_information (self ):
89
+ safe_MessageBeep (winsound .MB_ICONINFORMATION )
90
+
91
+ def test_stop (self ):
92
+ safe_MessageBeep (winsound .MB_ICONSTOP )
93
+
94
+ def test_warning (self ):
95
+ safe_MessageBeep (winsound .MB_ICONWARNING )
96
+
85
97
def test_keyword_args (self ):
86
98
safe_MessageBeep (type = winsound .MB_OK )
87
99
@@ -161,6 +173,15 @@ def test_stopasync(self):
161
173
# does not raise on systems without a sound card.
162
174
winsound .PlaySound (None , winsound .SND_PURGE )
163
175
176
+ def test_sound_sentry (self ):
177
+ safe_PlaySound ("SystemExit" , winsound .SND_ALIAS | winsound .SND_SENTRY )
178
+
179
+ def test_sound_sync (self ):
180
+ safe_PlaySound ("SystemExit" , winsound .SND_ALIAS | winsound .SND_SYNC )
181
+
182
+ def test_sound_system (self ):
183
+ safe_PlaySound ("SystemExit" , winsound .SND_ALIAS | winsound .SND_SYSTEM )
184
+
164
185
165
186
if __name__ == "__main__" :
166
187
unittest .main ()
Original file line number Diff line number Diff line change
1
+ Some :data: `!SND_* ` and :data: `!MB_* ` constants are added to :mod: `winsound `.
Original file line number Diff line number Diff line change @@ -56,7 +56,10 @@ PyDoc_STRVAR(sound_module_doc,
56
56
"SND_NODEFAULT - Do not play a default beep if the sound can not be found\n"
57
57
"SND_NOSTOP - Do not interrupt any sounds currently playing\n" // Raising RuntimeError if needed
58
58
"SND_NOWAIT - Return immediately if the sound driver is busy\n" // Without any errors
59
- "SND_APPLICATION - sound is an application-specific alias in the registry."
59
+ "SND_APPLICATION - sound is an application-specific alias in the registry.\n"
60
+ "SND_SENTRY - Triggers a SoundSentry event when the sound is played.\n"
61
+ "SND_SYNC - Play the sound synchronously, default behavior.\n"
62
+ "SND_SYSTEM - Assign sound to the audio session for system notification sounds.\n"
60
63
"\n"
61
64
"Beep(frequency, duration) - Make a beep through the PC speaker.\n"
62
65
"MessageBeep(type) - Call Windows MessageBeep." );
@@ -232,12 +235,19 @@ exec_module(PyObject *module)
232
235
ADD_DEFINE (SND_PURGE );
233
236
ADD_DEFINE (SND_LOOP );
234
237
ADD_DEFINE (SND_APPLICATION );
238
+ ADD_DEFINE (SND_SENTRY );
239
+ ADD_DEFINE (SND_SYNC );
240
+ ADD_DEFINE (SND_SYSTEM );
235
241
236
242
ADD_DEFINE (MB_OK );
237
243
ADD_DEFINE (MB_ICONASTERISK );
238
244
ADD_DEFINE (MB_ICONEXCLAMATION );
239
245
ADD_DEFINE (MB_ICONHAND );
240
246
ADD_DEFINE (MB_ICONQUESTION );
247
+ ADD_DEFINE (MB_ICONERROR );
248
+ ADD_DEFINE (MB_ICONINFORMATION );
249
+ ADD_DEFINE (MB_ICONSTOP );
250
+ ADD_DEFINE (MB_ICONWARNING );
241
251
242
252
#undef ADD_DEFINE
243
253
0 commit comments