Skip to content

Instantly share code, notes, and snippets.

@AlexArcPy
Created November 25, 2017 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexArcPy/80fd58b89c7023909f0e80ddc10a7ad8 to your computer and use it in GitHub Desktop.
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
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