Skip to content

Commit 7798242

Browse files
committed
Fix SVG histogram example.
`Element.getchildren` was removed in Python 3.9, but more importantly, blindly picking the first subelement is completely broken since we added metadata to SVG. Using XPath finds the `style` tag wherever it might be.
1 parent 15c774e commit 7798242

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/user_interfaces/svg_histogram_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
""" % json.dumps(hist_patches)
150150

151151
# Add a transition effect
152-
css = tree.getchildren()[0][0]
152+
css = tree.find('.//{http://www.w3.org/2000/svg}style')
153153
css.text = css.text + "g {-webkit-transition:opacity 0.4s ease-out;" + \
154154
"-moz-transition:opacity 0.4s ease-out;}"
155155

0 commit comments

Comments
 (0)