-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add a time
named argument to to_png
#764
Conversation
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): |
There was a problem hiding this comment.
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. | ||
|
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 | ||
-------- | ||
|
There was a problem hiding this comment.
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() | ||
|
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. | ||
|
There was a problem hiding this comment.
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
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W291 trailing whitespace
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.