:param node: :type node:
(node)
| 17506 | treeview.column(heading, width=width * _char_width_in_pixels(font) + 10, anchor=anchor) |
| 17507 | |
| 17508 | def add_treeview_data(node): |
| 17509 | """ |
| 17510 | |
| 17511 | :param node: |
| 17512 | :type node: |
| 17513 | |
| 17514 | """ |
| 17515 | if node.key != '': |
| 17516 | if node.icon: |
| 17517 | if node.icon not in element.image_dict: |
| 17518 | if type(node.icon) is bytes: |
| 17519 | photo = tk.PhotoImage(data=node.icon) |
| 17520 | else: |
| 17521 | photo = tk.PhotoImage(file=node.icon) |
| 17522 | element.image_dict[node.icon] = photo |
| 17523 | else: |
| 17524 | photo = element.image_dict.get(node.icon) |
| 17525 | |
| 17526 | node.photo = photo |
| 17527 | try: |
| 17528 | id = treeview.insert(element.KeyToID[node.parent], 'end', iid=None, text=node.text, values=node.values, open=element.ShowExpanded, image=node.photo) |
| 17529 | element.IdToKey[id] = node.key |
| 17530 | element.KeyToID[node.key] = id |
| 17531 | except Exception as e: |
| 17532 | print('Error inserting image into tree', e) |
| 17533 | else: |
| 17534 | id = treeview.insert(element.KeyToID[node.parent], 'end', iid=None, text=node.text, values=node.values, open=element.ShowExpanded) |
| 17535 | element.IdToKey[id] = node.key |
| 17536 | element.KeyToID[node.key] = id |
| 17537 | |
| 17538 | for node in node.children: |
| 17539 | add_treeview_data(node) |
| 17540 | |
| 17541 | add_treeview_data(element.TreeData.root_node) |
| 17542 | treeview.column('#0', width=element.Col0Width * _char_width_in_pixels(font), anchor=tk.W) |
no test coverage detected