pyqtlet2
pyqtlet2 copied to clipboard
Hyperlink in Popup
I am trying to include a hyperlink in the popup. For some reason this causes it not to popup. Here is the code. `import sys from PyQt5.QtWidgets import QApplication, QVBoxLayout, QWidget, QPushButton from pyqtlet2 import L, MapWidget
class MapWindow(QWidget): marker2 = L.marker
def __init__(self):
# Setting up the widgets and layout
super().__init__()
self.mapWidget = MapWidget()
self.layout = QVBoxLayout()
self.layout.addWidget(self.mapWidget)
self.button = QPushButton("Push Me")
self.layout.addWidget(self.button)
self.setLayout(self.layout)
self.button.clicked.connect(self.add_point)
# Working with the maps with pyqtlet
self.map = L.map(self.mapWidget)
self.map.setView([12.97, 77.59], 10)
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(self.map)
self.marker = L.marker([12.934056, 77.610029])
self.marker.bindPopup('Maps are a treasure.' + '<a href="https://www.google.com">Visit Google</a>')
self.map.addLayer(self.marker)
self.marker.click.connect(self.click_marker)
self.show()
def add_point(self):
print("added point")
def click_marker(self, event):
print("click", event)
if name == 'main': app = QApplication(sys.argv) widget = MapWindow() sys.exit(app.exec_())`
I did dig down to the next level in the layer.py bindpopup function and there is one thing line 55: shows the js value => 'l1.bindPopup("Maps are a treasure.Visit Google")' and there might be an extra qoute at the end. So i put the string in the way i think that it should be without it. But didnt fix it. Also i see the logger in here but i am unsure how to use it. How do i enable it. Thanks in advance.