Tkinter bell() 方法
Tkinter bell() 方法会产生系统默认的事件或对话声音。此方法可以在默认窗口或框架中调用。通过进入系统配置,我们可以更改窗口的声音。
在此示例中,我们将创建一个会发出默认声音的按钮。
示例
#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()输出
运行上述代码将创建一个按钮,点击该按钮将发出系统的声音。

广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP