Tkinter bell() method

PythonTkinterGUI-Programming

Tkinter bell() method produces the default event or dialogue sound of the system. This method can be invoked in the default window or frame. We can change the sound of the window by going to the system configuration.

In this example, we will create a button that will make the default sound.

Example

#Import the library
from tkinter import *

#Create an instance of tkinter frame
win= Tk()

#Define the size of the window
win.geometry("700x150")
win.resizable(0,0)

#Define the Bell function

def click():
   win.bell()

Button(win,text= "Click Me", command= click).pack(pady=20)

win.mainloop()

Output

Running the above code will create a button and clicking over that will produce the sound of the system.

raja
Published on 06-Mar-2021 09:02:09
Advertisements