Skip to content

Add a time named argument to to_png #764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 2, 2017

Conversation

hunterowens
Copy link
Contributor

Since it might take longer than 3 seconds to render the map, this adds a time named arg that allows you to delay the screenshot.

Since it might take longer than 3 seconds to render the map, this adds a time named arg that allows you to delay the screenshot.
folium/folium.py Outdated
@@ -267,8 +267,19 @@ def _repr_html_(self, **kwargs):
out = self._parent._repr_html_(**kwargs)
return out

def _to_png(self):
"""Export the HTML to byte representation of a PNG image."""
def _to_png(self, time=3):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F811 redefinition of unused 'time' from line 12

folium/folium.py Outdated
"""Export the HTML to byte representation of a PNG image."""
def _to_png(self, time=3):
"""Export the HTML to byte representation of a PNG image.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W293 blank line contains whitespace

folium/folium.py Outdated
def _to_png(self, time=3):
"""Export the HTML to byte representation of a PNG image.

Uses Phantom JS to render the HTML and record a PNG. You may need to

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W291 trailing whitespace

folium/folium.py Outdated
"""Export the HTML to byte representation of a PNG image.

Uses Phantom JS to render the HTML and record a PNG. You may need to
adjust the time keyword argument if maps render without data or tiles.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W291 trailing whitespace

folium/folium.py Outdated
adjust the time keyword argument if maps render without data or tiles.
Examples
--------

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W293 blank line contains whitespace

folium/folium.py Outdated
--------

map._to_png()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W293 blank line contains whitespace

folium/folium.py Outdated

map._to_png()

map._to_png(time=10) # Wait 10 seconds between render and snapshot.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W291 trailing whitespace

folium/folium.py Outdated
map._to_png()

map._to_png(time=10) # Wait 10 seconds between render and snapshot.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W293 blank line contains whitespace

@ocefpaf
Copy link
Member

ocefpaf commented Nov 2, 2017

Since it might take longer than 3 seconds to render the map, this adds a time named arg that allows you to delay the screenshot.

Makes perfect sense. Thanks!

folium/folium.py Outdated
def _to_png(self, delay=3):
"""Export the HTML to byte representation of a PNG image.

Uses Phantom JS to render the HTML and record a PNG. You may need to

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W291 trailing whitespace

folium/folium.py Outdated
"""Export the HTML to byte representation of a PNG image.

Uses Phantom JS to render the HTML and record a PNG. You may need to
adjust the `delay` time keyword argument if maps render without data or tiles.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W291 trailing whitespace

folium/folium.py Outdated
Examples
--------
>>> map._to_png()
>>> map._to_png(time=10) # Wait 10 seconds between render and snapshot.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W291 trailing whitespace

@ocefpaf ocefpaf merged commit f8a12a6 into python-visualization:master Nov 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants