Используйте окно Toplevel, чтобы создать собственное окно сообщения, и используйте bind для обработки регистра.
from tkinter import *
from tkinter import messagebox
def handler(frame):
print("STOP!")
sys.exit(1)
root = Tk()
top = Toplevel(root)
top.title("About this application...")
top.bind('<Control-c>', handler)
msg = Message(top, text="###################")
msg.pack()
button = Button(top, text="Dismiss", command=top.destroy)
button.pack()
root.mainloop()
список имен событий для привязки!
from tkinter import *
from tkinter import messagebox
def handler(frame):
print("STOP!")
sys.exit(1)
root = Tk()
root.geometry("{0}x{1}".format(root.winfo_screenwidth()-3, root.winfo_screenheight()-3))
top = Toplevel(root, takefocus=True)
top.title("This is a message box")
w = top.winfo_reqwidth()
h = top.winfo_reqheight()
ws = top.winfo_screenwidth()
hs = top.winfo_screenheight()
x = (ws/2) - (w/2)
y = (hs/2) - (h/2)
top.geometry('%dx%d+%d+%d' % (300, 100, x, y))
top.attributes("-topmost", True)
top.bind('<Control-c>', handler)
lbl = Label(top, text="This is a message...")
lbl.pack(expand=True, fill='x')
button = Button(top, text="OK", command=top.destroy)
button.focus_set()
button.pack(pady=2)
root.mainloop()