On Sat, 11 Aug 2018 13:01:44 -0700, wfgazdzik wrote:

> I have a main window open.  Then I open a tk.TopLevel dialog window
> giving the user multiple choices.  He selects one, the corresponding
> event is executed.  Then in the underlining main window, just by chance
> there is another button exactly under the mouse click in the TopLevel
> dialog window.  Its corresponding event is then triggered.

Sounds to me that the user is clicking twice, once in the dialog, and 
then a second time just as it disappears and the main window takes focus.

Possibly they are trying to double-click.

Or their mouse is faulty.

Unless you can replicate this with multiple users, the most likely cause 
is user-error. And unless you can eliminate user-error, trying to work-
around users who click randomly is a nightmare. How do you decide which 
clicks are intended and which are not?

> How can I keep the main window button that just happens to be in the
> wrong place from being triggered?

If you put in a delay between enacting the event and closing the dialog, 
I reckon the problem will go away... but instead you'll have two click 
events in the dialog.

But it seems like an interesting experiment... put time.sleep(0.3) at the 
end of the event handler and see what happens.

Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson


Reply via email to