简体   繁体   English

我可以在自定义的Tkinter Toplevel()窗口上获得消息框的图标=“ warning”噪音吗?

[英]Can I get messagebox's icon=“warning” noise on a custom Tkinter Toplevel() window?

I like the warning noise that messagebox provides out of the box (no pun intended), as in the GUI below. 我喜欢消息框提供的开箱即用的警告声音(无双关语),如下面的GUI所示。

from tkinter import messagebox

messagebox.showinfo("my title", "my message", icon="warning", parent=None)

However, I need more customization than messagebox offers, so I've created my own window. 但是,除了消息框提供的功能之外,我还需要更多的自定义功能,因此我创建了自己的窗口。 Is there a way to include the same warning noise with a Toplevel() window? 有没有办法在Toplevel()窗口中包含相同的警告噪声?

I'm using Python3 and Tkinter 8.5. 我正在使用Python3和Tkinter 8.5。

I think you would need to manually sound it 我认为您需要手动将其听起来

import Tkinter 
Tkinter.Tk().bell() 

or maybe you can just do SomeWindow.bell() (to be honest im not overly familiar with tkinter) 或者也许你可以做SomeWindow.bell() (说实话我不太熟悉SomeWindow.bell()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM