Ada yang pernah buat Arcgis python addin tapi untuk interface pakai Tk inter atau Wxpython atau Qt.
Saya sudahcoba untuk Tkinter arcmap jadi crash, kalau pakai wxpython dialog ga bisa di close,
jadi untuk interface sementara tetep pakai dialog arctoolbox,
import arcpy
import pythonaddins
import wx
class ToolClass2(object):
"""Implementation for DesignTool.tool (Tool)"""
dlg= None
def __init__(self):
self.enabled = True
self.shape = "NONE"
self.cursor=3
def onMouseDownMap(self, x, y, button, shift):
global laylist
laylist=[]
mxd=arcpy.mapping.MapDocument("CURRENT")
for lyr in arcpy.mapping.ListLayers(mxd):
laylist.append(lyr.name)
del mxd
if self.dlg is None:
self.dlg = TestDialog()
else:
self.dlg.Show(True)
return
class TestDialog(wx.Frame):
def __init__(self):
wxStyle = wx.CAPTION | wx.RESIZE_BORDER | wx.MINIMIZE_BOX |wx.CLOSE_BOX | wx.SYSTEM_MENU | wx.CB_DROPDOWN
wx.Frame.__init__(self, None, -1, "Main Menu", style=wxStyle, size=(330, 370))
self.SetMaxSize((330, 370))
self.SetMinSize((330, 370))
self.Bind(wx.EVT_CLOSE, self.OnClose)
panel = wx.Panel(self, -1)
wx.StaticText(panel, -1, "Choose Layer:", pos=(8,64))
self.LayerCombo = wx.ComboBox(panel, -1, value=laylist[1], pos=(180, 64), size=(120,21), choices=laylist)
self.Bind(wx.EVT_BUTTON, self.OnSet, id=self.btnSet.GetId())
self.Show(True)
def OnClose(self, event):
self.Show(False) # self.Destroy() doesn't work
def OnSet(self, event):
Layerpath= str(self.LayerCombo.GetValue())
self.Show(False)
app = wx.PySimpleApp()
app.MainLoop()
kalau ada share code samplenya dong,
terimakasih