Is it using listbox? context-menu? inserting widgets within text? something else?
Also, is there some documentation about how IDLE functions? Which python files do what, etc?
Is it using listbox? context-menu? inserting widgets within text? something else?
Also, is there some documentation about how IDLE functions? Which python files do what, etc?
The autocompletewindow
is a tk Toplevel
with a Listbox
and Scrollbar
. Code is in idlelib/AutoCompleteWindow.py (and associated code in AutoComplete.py).
The Idle doc gives a user view of Idle. There is no doc giving a programmer view of idlelib. (I wish there had been one when I started with Idle. Now that I understand what most of the files do, I should write something.)
EDIT: Tk and Toplevel widgets are located with respect to the desktop by passing a geometry string to the .geometry
(== .wm_geometry
) method. Note that the 'wxh' part of the string can be omitted to just pass '+x+y', as in the Idle code.
CallTipWindow.position_window
calculates x and y from widget.winfo_rootx/y and Text.bbox and an offset. If the calltip is triggered by typing (
, the box is around that character. AutoCompleteWindow.winconfig_event
does something similar, but also uses winfo_width/height
methods.
EDIT 2: Popup menus can be positioned with Menu.post(x, y), (or Menu.tk_popup) where x, y are relative to root. (Working example)