更改tkinter消息框按钮上的文字 [英] Change words on tkinter Messagebox buttons
问题描述
我正在使用tkinter的"askokcancel"消息框来警告用户带有不可逆操作的弹出窗口.
I'm using tkinter's "askokcancel" message box to warn the user, with a pop-up, of an irreversible action.
from tkinter import Tk
Tk().withdraw()
from tkinter.messagebox import askokcancel
askokcancel("Warning", "This will delete stuff")
我想将确定"按钮的文本(从确定")更改为删除"之类的文字,以减少其外观.
I'd like to change the text of the 'OK' button (from 'OK') to something like 'Delete', to make it less benign-looking.
这可能吗?
如果没有,实现此目标的另一种方法是什么?最好不要引入任何依赖性...
If not, what is another way to achieve it? Preferably without introducing any dependancies...
推荐答案
否,无法更改内置对话框的按钮文本.
No, there is no way to change the text of the buttons for the built-in dialogs.
您最好的选择是创建自己的对话框.这并不是很困难,它使您可以完全控制对话框小部件中的内容.
Your best option is to create your own dialog. It's not very hard to do, and it gives you absolute control over what is in the dialog widget.
这篇关于更改tkinter消息框按钮上的文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!