How can I change the "Okay" string shown in the button from a messagebox.showerror() widget on Python? Tkinter related [duplicate]

Solution 1:

Why not open a child window thus creating your own box with your own button like this:

from tkinter import *
def messageWindow():
    win = Toplevel()
    win.title('warning')
    message = "This will delete stuff"
    Label(win, text=message).pack()
    Button(win, text='Delete', command=win.destroy).pack()
root = Tk()
Button(root, text='Bring up Message', command=messageWindow).pack()
root.mainloop()

Solution 2:

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.