Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bcd1e1c

Browse files
authored
Eliminates Enumerate
References the index of the shape object instead of the enumeration.
1 parent 74aeb10 commit bcd1e1c

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

examples/user_interfaces/svg_tooltip.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,14 @@
6565
tree, xmlid = ET.XMLID(f.getvalue())
6666
tree.set('onload', 'init(evt)')
6767

68-
for i in enumerate(shapes):
68+
for i in shapes:
69+
# Get the index of the shape
70+
index = shapes.index(i)
6971
# Hide the tooltips
70-
tooltip = xmlid['mytooltip_{:03d}'.format(i[0])]
72+
tooltip = xmlid['mytooltip_{:03d}'.format(index)]
7173
tooltip.set('visibility', 'hidden')
7274
# Assign onmouseover and onmouseout callbacks to patches.
73-
mypatch = xmlid['mypatch_{:03d}'.format(i[0])]
75+
mypatch = xmlid['mypatch_{:03d}'.format(index)]
7476
mypatch.set('onmouseover', "ShowTooltip(this)")
7577
mypatch.set('onmouseout', "HideTooltip(this)")
7678

0 commit comments

Comments
 (0)