-
Notifications
You must be signed in to change notification settings - Fork 13
Embedding
Sam Gillingham edited this page Mar 6, 2024
·
4 revisions
This page describes how to embed TuiView in another PyQt5 application.
The recommended way to create TuiView windows in your own application is to use the GeolinkedWindows interface:
import sys
from PyQt5.QtWidgets import QApplication
from tuiview import geolinkedviewers
app = QApplication(sys.argv)
glviewers = geolinkedviewers.GeolinkedViewers()
viewer = glviewers.newViewer()
app.exec()
viewer will be an instance of ViewerWindow. Note: you can pass a filename to the glviewers.newViewer() function to start with an open file, otherwise call addRasterInternal()/addVectorInternal() on the ViewerWindow instance to add files programmatically.
You can also add the TuiView widget (the part of the window that holds the map) to your own windows and widgets:
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout
from tuiview import viewerwidget
app = QApplication(sys.argv)
w = QWidget()
layout = QVBoxLayout()
map = viewerwidget.ViewerWidget(w)
layout.addWidget(map)
w.setLayout(layout)
w.resize(250, 150)
w.move(300, 300)
w.setWindowTitle('Simple')
w.show()
app.exec()