Skip to content
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

Hyperlink in Popup #34

Open
burkeerr opened this issue May 10, 2022 · 1 comment
Open

Hyperlink in Popup #34

burkeerr opened this issue May 10, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@burkeerr
Copy link

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_())`

@burkeerr
Copy link
Author

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.

@JaWeilBaum JaWeilBaum added the bug Something isn't working label May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants