Version 0.9.0
Changes
pyqtlet2 in version 0.9.0
now supports multiple maps in one application!
Closed issues:
Sample Code:
import sys
from PyQt5.QtWidgets import QApplication, QHBoxLayout, QWidget
from pyqtlet2 import L, MapWidget
import pyqtlet2.leaflet.core
class MapWindow(QWidget):
def __init__(self):
# Setting up the widgets and layout
super().__init__()
self.mapWidget1 = MapWidget()
self.mapWidget2 = MapWidget()
self.layout = QHBoxLayout()
self.layout.addWidget(self.mapWidget1)
self.layout.addWidget(self.mapWidget2)
self.setLayout(self.layout)
# Working with the maps with pyqtlet
self.map1 = L.map(self.mapWidget1)
self.map1.setView([12.97, 77.59], 10)
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(self.map1)
self.map2 = L.map(self.mapWidget2)
self.map2.setView([12.97, 77.59], 10)
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(self.map2)
self.marker1 = L.marker([12.934056, 77.610029], options={'draggable': True}).addTo(self.map1)
self.marker1.bindPopup('Maps are a treasure.')
self.marker1.moveend.connect(print)
self.marker2 = L.marker([12.934056, 77.610029]).addTo(self.map2)
self.marker2.setDragging(True)
self.marker2.bindPopup('Maps are a treasure.')
self.marker2.moveend.connect(print)
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
widget = MapWindow()
sys.exit(app.exec_())
Download via PyPi