1

I have a tkinter dialog box which uses messagebox.askquestion to ask if a user wants to delete a file.

from tkinter import messagebox

choice = messagebox.askquestion("Delete file", "Are you sure you want to delete this file?")
if choice == 'yes':
    print("Delete file")

Instead of using Yes/No as my options, I want to change them to explicitly say Delete/Cancel.

How can I modify the Yes/No options in a tkinter prompt?

"Are you sure you want to delete this file?"

Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
  • 1
    I'm pretty sure tkinter doesn't support this and you'll have to roll your own custom message dialog. – Aran-Fey Mar 29 '18 at 17:37
  • The whole point of using the messagebox standard types is that they have standard buttons, with names that get automatically translated in standard ways. If you don't want that, you _can_ dig into it and fiddle with the widgets during creation, but it's more work than just creating your own dialog box, so why? – abarnert Mar 29 '18 at 17:43
  • 1
    Your best option is to use `Toplevel()` and create your own messagebox. – Mike - SMT Mar 29 '18 at 17:49

0 Answers0