Utility to display the available icons.
(icondir=ICONDIR)
| 35 | raise RuntimeError(f"can't find icon directory ({ICONDIR!r})") |
| 36 | |
| 37 | def 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 | |
| 59 | def wheel_event(event, widget=None): |
| 60 | """Handle scrollwheel event. |
nothing calls this directly
no test coverage detected
searching dependent graphs…