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

Function listicons

Lib/idlelib/tree.py:37–57  ·  view source on GitHub ↗

Utility to display the available icons.

(icondir=ICONDIR)

Source from the content-addressed store, hash-verified

35 raise RuntimeError(f"can't find icon directory ({ICONDIR!r})")
36
37def listicons(icondir=ICONDIR):
38 """Utility to display the available icons."""
39 root = Tk()
40 import glob
41 list = glob.glob(os.path.join(glob.escape(icondir), "*.gif"))
42 list.sort()
43 images = []
44 row = column = 0
45 for file in list:
46 name = os.path.splitext(os.path.basename(file))[0]
47 image = PhotoImage(file=file, master=root)
48 images.append(image)
49 label = Label(root, image=image, bd=1, relief="raised")
50 label.grid(row=row, column=column)
51 label = Label(root, text=name)
52 label.grid(row=row+1, column=column)
53 column = column + 1
54 if column >= 10:
55 row = row+2
56 column = 0
57 root.images = images
58
59def wheel_event(event, widget=None):
60 """Handle scrollwheel event.

Callers

nothing calls this directly

Calls 11

TkClass · 0.85
PhotoImageClass · 0.85
escapeMethod · 0.80
splitextMethod · 0.80
LabelClass · 0.50
globMethod · 0.45
joinMethod · 0.45
sortMethod · 0.45
basenameMethod · 0.45
appendMethod · 0.45
gridMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…