Python Forum
[Tkinter] Sound from the tkinter.messagebox
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Sound from the tkinter.messagebox
#1
Hey Guys,
I created one simple notebook now, When I click the button "message button" likes Author, version and copyright, the windows sound. But I checked the code, there is no setting for this. How I can mute this?

[Image: NDI2NzQ3NF8xMzM4MTA1MQ]

Thanks.
def author():
    showinfo('Author', ' This software is completed by Kevin LIU')


def copyright():
    showinfo('Copyright', 'The copyright of this software is owned by Kevin LIU')


def version():
    showinfo('Version', '1.0.0')
Reply
#2
The bell sound not made by tkinter. Dialog boxes are supplied by the OS,
and so are controlled by the OS rather than Python.
You could make your own custom message box, is one way around it.

Another way is to mute the system sound until the messagebox has been ckleared then un-mute:


You can use the Windows Sound Manager by paradoxis
https://github.com/Paradoxis/Windows-Sound-Manager

from sound import Sound
Sound.mute()

Every call to Sound.mute() will toggle mute on or off.

Better still I have stripped away all the bull and it all just boils down to a keypress:

from keyboard import Keyboard

Keyboard.key(Keyboard.VK_VOLUME_MUTE)
that's all you need. call again to toggle mute.
Reply
#3
Pyautogui offers pop ups with no sound:

pyautogui.alert('This displays some text with an OK button.')
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter messagebox and using datetime/timedelta Kaltex 3 3,245 Apr-07-2021, 06:23 PM
Last Post: Yoriz
  [Tkinter] Messagebox with playsound khandelwalbhanu 6 4,306 May-16-2020, 11:40 AM
Last Post: chesschaser
  [Tkinter] messagebox is not being executed please help erwinsiuda 2 2,242 Apr-02-2020, 01:56 AM
Last Post: Larz60+
  [Tkinter] passing data to messagebox kmusawi 0 1,776 Feb-18-2019, 01:51 AM
Last Post: kmusawi
  Adding timer on the Messagebox aniyanetworks 6 11,565 Feb-13-2019, 07:48 PM
Last Post: aniyanetworks
  [Tkinter] Button widget gets stuck from using tkinter.messagebox? Nwb 2 3,852 Jun-20-2018, 02:21 PM
Last Post: Nwb

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020