'Can you make this a function in the python folium?

import io
import sys

import folium
from PyQt5 import QtWidgets, QtWebEngineWidgets


if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    m = folium.Map(
        location=[45.5236, -122.6750], zoom_start=13
    )

    data = io.BytesIO()
    m.save(data, close_file=False)

    w = QtWebEngineWidgets.QWebEngineView()
    w.setHtml(data.getvalue().decode())
    w.resize(640, 480)
    w.show()

    sys.exit(app.exec_())

I want to make this a function and update the data while operating every certain time. But when I did that, the results didn't come out. There was no error either. (I wrote it in Picham in Mac(m1 MacBook Air).



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source