Skip to content

Instantly share code, notes, and snippets.

@avaccari
Created January 18, 2016 18:04
Show Gist options
  • Save avaccari/e49d13aa76c8e9448980 to your computer and use it in GitHub Desktop.
Save avaccari/e49d13aa76c8e9448980 to your computer and use it in GitHub Desktop.
Pop-up a message from an ArcGIS python toolbox using ctypes
import ctypes
class Toolbox(object):
def __init__(self):
self.label = "popup message dev"
self.alias = "pupMesg_dev"
self.tools = [PopupMessage]
class PopupMessage(object):
def __init__(self):
self.label = "How do we popup messages?"
self.description = "Simple windll popup message example"
self.canRunInBackground = True
return
def getParameterInfo(self):
params = None
return params
def isLicensed(self):
return True
def updateParameters(self, parameters):
return
def udateMessages(self, parameters, messages):
return
def execute(self, parameters, messages):
"""Popup a message using ctype call to windll"""
# This is a very simple way to pop up messages.
text = "This is the message"
title = "This is the title of the window"
ctypes.windll.user32.MessageBoxA(0, text, title, 1)
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment