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

Method __init__

Lib/idlelib/configdialog.py:2367–2400  ·  view source on GitHub ↗
(self, parent, *args, **kw)

Source from the content-addressed store, hash-verified

2365 * This frame only allows vertical scrolling
2366 """
2367 def __init__(self, parent, *args, **kw):
2368 Frame.__init__(self, parent, *args, **kw)
2369
2370 # Create a canvas object and a vertical scrollbar for scrolling it.
2371 vscrollbar = Scrollbar(self, orient=VERTICAL)
2372 vscrollbar.pack(fill=Y, side=RIGHT, expand=FALSE)
2373 canvas = Canvas(self, borderwidth=0, highlightthickness=0,
2374 yscrollcommand=vscrollbar.set, width=240)
2375 canvas.pack(side=LEFT, fill=BOTH, expand=TRUE)
2376 vscrollbar.config(command=canvas.yview)
2377
2378 # Reset the view.
2379 canvas.xview_moveto(0)
2380 canvas.yview_moveto(0)
2381
2382 # Create a frame inside the canvas which will be scrolled with it.
2383 self.interior = interior = Frame(canvas)
2384 interior_id = canvas.create_window(0, 0, window=interior, anchor=NW)
2385
2386 # Track changes to the canvas and frame width and sync them,
2387 # also updating the scrollbar.
2388 def _configure_interior(event):
2389 # Update the scrollbars to match the size of the inner frame.
2390 size = (interior.winfo_reqwidth(), interior.winfo_reqheight())
2391 canvas.config(scrollregion="0 0 %s %s" % size)
2392 interior.bind('<Configure>', _configure_interior)
2393
2394 def _configure_canvas(event):
2395 if interior.winfo_reqwidth() != canvas.winfo_width():
2396 # Update the inner frame's width to fill the canvas.
2397 canvas.itemconfigure(interior_id, width=canvas.winfo_width())
2398 canvas.bind('<Configure>', _configure_canvas)
2399
2400 return
2401
2402
2403if __name__ == '__main__':

Callers

nothing calls this directly

Calls 10

create_windowMethod · 0.95
ScrollbarClass · 0.90
CanvasClass · 0.90
FrameClass · 0.90
xview_movetoMethod · 0.80
yview_movetoMethod · 0.80
__init__Method · 0.45
packMethod · 0.45
configMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected