Currently, we have:
OpenDialog
SaveDialog
GPToolDialog
MessageBox
But there's no way to actually get user input. Why is this? Does ESRI plan on eventually providing a way to get user input?
What are the input requirements?
One solution is to create a new tool in a Toolbox.tbx and setup input parameters. Then you can open/popup this as a UI with:
pythonaddins.GPToolDialog(r'<path>\<toolboxname.tbx>', '<tool name>')
Here's how it might look hooked into an add-in with a button tool:
class ButtonClass_CreateSHP(object): """Implementation for my_addin.button_1 (Button)""" def __init__(self): self.enabled = True self.checked = False def onClick(self): pythonaddins.GPToolDialog(r'<path>\<toolboxname.tbx>', 'CreateShapefile')
Yeah, I've thought about that. I just see it as kind of a clunky, unattractive way of doing it. I'd be nice to just have a dialog box that the user could enter a value into- it seems simple enough.
One example is that I'd like to have a button that when clicked takes an OID of a specific layer for input, and zooms to that feature based on the OID entered. Easy enough to do, but the whole user input part is missing.
I think you can accomplish this with the Tool Validator and set the input parameter when you launch the tool:
pythonaddins.GPToolDialog(r'<path>\<toolboxname.tbx>', '<tool name>', '<arg1>', '<arg2')
Right. I guess my main point is that I'd like to have a way of getting user input without needing to use an existing toolbox.
Tkinter maybe? Not sure how well it behaves though.
ArcMap does not play nicely with any Python modules that have a non-ArcMap GUI. I've tried Tkinter and others, before finding that it just randomly crashes ArcMap. Subsequent Googling found that other people have concluded that non-ArcMap GUI's in Python add-ins clash with ArcMap and cause it to crash.
Do you have it in a Toolbox? It's easy to create a Python addin from a tools box that will have a user interface. For what it's worth, I have some steps listed in a power point Python add-ins vs. .NET add-ins?
And there is a tech session Python Add-ins: Tips and Tricks that might be worth checking out.
Rebecca, Jason's presentation is still just a bunch of blank screens with titles..I suspect some iThingy problem. There are still a bunch of posts on that thread...Do you have a link that can be read with all content?
Dan, your right. I looked at it a while ago and just copied the link. I'll edit my post.