Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7798242

Browse filesBrowse 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
Copy full SHA for 7798242

File tree

Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed

‎examples/user_interfaces/svg_histogram_sgskip.py

Copy file name to clipboardExpand all lines: examples/user_interfaces/svg_histogram_sgskip.py
+1-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.