Created
November 25, 2017 16:04
-
-
Save AlexArcPy/80fd58b89c7023909f0e80ddc10a7ad8 to your computer and use it in GitHub Desktop.
Basic PyQt5 application to run in ArcGIS Pro custom script tool: running in own thread
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import threading | |
import arcpy | |
from PyQt5.QtWidgets import (QMainWindow, QLabel, QApplication) | |
from PyQt5.QtCore import Qt | |
class MainWindow(QMainWindow): | |
def __init__(self, *args, **kwargs): | |
super(MainWindow, self).__init__(*args, **kwargs) | |
self.setWindowTitle("Basic App") | |
product = arcpy.CheckProduct('arcview') | |
label = QLabel( | |
"Q: Is `arcview` license available? \n A: {}".format(product)) | |
label.setAlignment(Qt.AlignCenter) | |
self.setCentralWidget(label) | |
def main(): | |
app = QApplication(sys.argv) | |
ex = MainWindow() | |
ex.show() | |
sys.exit(app.exec_()) | |
if __name__ == '__main__': | |
t = threading.Thread(target=main) | |
t.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment