MCPcopy Index your code
hub / github.com/python/cpython / __init__

Method __init__

Lib/idlelib/config_key.py:284–328  ·  view source on GitHub ↗

parent - parent of this dialog title - string which is the title of the popup dialog action - string, the name of the virtual event these keys will be mapped to current_key_sequences - list, a list of all key sequence lists currently

(self, parent, title, action, current_key_sequences,
                 *, _htest=False, _utest=False)

Source from the content-addressed store, hash-verified

282class GetKeysWindow(Toplevel):
283
284 def __init__(self, parent, title, action, current_key_sequences,
285 *, _htest=False, _utest=False):
286 """
287 parent - parent of this dialog
288 title - string which is the title of the popup dialog
289 action - string, the name of the virtual event these keys will be
290 mapped to
291 current_key_sequences - list, a list of all key sequence lists
292 currently mapped to virtual events, for overlap checking
293 _htest - bool, change box location when running htest
294 _utest - bool, do not wait when running unittest
295 """
296 super().__init__(parent)
297 self.withdraw() # Hide while setting geometry.
298 self['borderwidth'] = 5
299 self.resizable(height=False, width=False)
300 # Needed for winfo_reqwidth().
301 self.update_idletasks()
302 # Center dialog over parent (or below htest box).
303 x = (parent.winfo_rootx() +
304 (parent.winfo_width()//2 - self.winfo_reqwidth()//2))
305 y = (parent.winfo_rooty() +
306 ((parent.winfo_height()//2 - self.winfo_reqheight()//2)
307 if not _htest else 150))
308 self.geometry(f"+{x}+{y}")
309
310 self.title(title)
311 self.frame = frame = GetKeysFrame(self, action, current_key_sequences)
312 self.protocol("WM_DELETE_WINDOW", self.cancel)
313 frame_buttons = Frame(self)
314 self.button_ok = Button(frame_buttons, text='OK',
315 width=8, command=self.ok)
316 self.button_cancel = Button(frame_buttons, text='Cancel',
317 width=8, command=self.cancel)
318 self.button_ok.grid(row=0, column=0, padx=5, pady=5)
319 self.button_cancel.grid(row=0, column=1, padx=5, pady=5)
320 frame.pack(side='top', expand=True, fill='both')
321 frame_buttons.pack(side='bottom', fill='x')
322
323 self.transient(parent)
324 _setup_dialog(self)
325 self.grab_set()
326 if not _utest:
327 self.deiconify() # Geometry set, unhide.
328 self.wait_window()
329
330 @property
331 def result(self):

Callers

nothing calls this directly

Calls 15

FrameClass · 0.90
ButtonClass · 0.90
_setup_dialogFunction · 0.90
superClass · 0.85
GetKeysFrameClass · 0.85
update_idletasksMethod · 0.80
winfo_rootxMethod · 0.80
winfo_widthMethod · 0.80
winfo_reqwidthMethod · 0.80
winfo_rootyMethod · 0.80
winfo_heightMethod · 0.80
winfo_reqheightMethod · 0.80

Tested by

no test coverage detected