◐ Shell
clean mode source ↗

bpo-38943: Fix IDLE autocomplete window not always appearing by JohnnyNajera · Pull Request #17416 · python/cpython

Without knowing what the problem to be fixed it, I cannot judge whether the 1 millisecond delay should really fix it. I worry that calling geometry after is_configuring is set false could under some circumstances trigger another call.

My deeper problem with the patch is that it is yet another kludge on what I consider a flawed design. We want the positioning function to be done once. Yet it is bound to an event that happens multiple times. The first Configure event is from 'wm_geometry("+10000+10000")' in show_window. This is not needed (and would not work on a future 16K monitor) and is done for no other popup (window.withdraw also makes a window invisible). That event is later bound to winconfig_event and we depend on that post-event binding to trigger the function. Instead, we should just call the positioning function when needed, as we do with calltips and all dialogs.

Within the function, 'acw.update' triggers more Configure events (4 on Windows). So is_configuring is needed to avoid infinite recursion. On Windows, there are other Configure events, so the function is unbound from Configure events in the first call. Without all this nonsense, we don't seem to have no-show problems on other systems.

If we touch this stuff, we have to manually test on all three systems, so I want to refactor to make it better. Perhaps we should make this a tooltip subclass, as with calltips.