Ask coding questions

← Back to all posts
run html with the main repl python
laval (0)

https://replit.com/@laval/essai-py-html-ameliore#main.py
Hello, my program does generate map.html but does not want to launch it from this main. On the other main by doing a copy paste and a new program in html it works!
import folium
import webbrowser

class Map:
def init(self, center, zoom_start):
self.center = center
self.zoom_start = zoom_start

def showMap(self):
    #Create the map
    my_map = folium.Map(location = self.center, zoom_start = self.zoom_start)

    #Display the map
    my_map.save("map.html")
           

#Define coordinates of where we want to center our map
lat=input("quelle est la lattitude ? :")
long=input("quelle est la longitude ? :")
zoom1 = input("valeur du zoom ? :")
coords = [lat,long]
map = Map(center = coords, zoom_start = zoom1)
map.showMap()
webbrowser.open_new_tab("//map.html")

Voters
laval (0)
Comments
hotnewtop
WWEMONSTERMONST (25)

webbrowser.opne_new_tab takes a url as i saw in python docs webbrowser.open_new_tab(url). Well i think you can use python flask. Flask is a web framework where you can use python as a backend. Hope helped you in any way.