0

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.

  • "I'm building control application that blocks the user from using the computer until it get unlocked by the operator." I don't it's the right way to accomplish this. I don't even think it's enough code to reproduce the problem. And I didn't get ANY popup message at all. – Parviz Karimli Aug 30 '16 at 16:23
  • You right, I didn't mention all the application code because it's not the problem. the code I mention comes to show how I force the focus of the application. My problem as I mentioned, is to make multiple popup messages, without the blocking issue and although the forcing method. – justlittlequestion Aug 30 '16 at 16:39

0 Answers0