I'm building control application that blocks the user from using the computer until it get unlocked by the operator.
During the lock, the operator can send messages to the user's computer, and those messages showed to the user by popup messages.
Problem Case:
If the operator send two messages or more, only the first message shows up, because I'm using tkMessageBox.showinfo()
and it blocking until the user hit the ok button.
Now you probably asking why I don't build my own message box class and make it shows multiple times without blocking?
Actually I cannot do this because the application has focus forcing
.
This is the application constructor and the focus forcing
method:
def __init__(self):
self.root_window = Tkinter.Tk()
self.main_frame = Tkinter.Frame(self.root_window)
self.root_window.update_idletasks()
height = self.root_window.winfo_screenheight()
width = self.root_window.winfo_screenwidth()
x = self.root_window.winfo_screenwidth() / 2 - width / 2
y = self.root_window.winfo_screenheight() / 2 - height / 2
self.root_window.geometry('{}x{}+{}+{}'.format(width, height, x, y))
# focus forcing
self.root_window.bind("<FocusOut>", self.app_lost_focus)
def app_lost_focus(self, event):
self.root_window.focus_set()
self.root_window.after(1, lambda: self.root_window.focus_force())
Now, if you know any other alternative for popup message that does'nt have blocking and can show up multiple times [and seen although the focus forcing
] I will be glad to hear about it.