I'm building a tkinter application in which several Toplevels might be open at any one time. If a user provides invalid input when performing a new calculation, possibly unrelated to those that led to other open Toplevels, I need for a messagebox.showerror to appear without closing any of the open Toplevels.
The problem I'm encountering is that the messagebox appears on top of the root but is obscured by the open Toplevels. The pseudocode snippet below appears at the start of a function that performs the desired calculation:
if input is invalid:
messagebox.showerror('Error','Your input is invalid!')
return
It would be simple to close the Toplevels before showing the error message, but I'd strongly prefer they stay open while the user corrects their error.
Is there an option for messagebox.showerror that will accomplish what I desire? (I can't locate one.) Is it possible to place my messagebox inside a new Toplevel that appears on top of all others? Or must I resort to creating a button manually with a new callback that serves the purpose of the return above?