Jump to content

[TANYA] Arcgis python Add in


asnaeb

Recommended Posts

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

Edited by asnaeb
Link to comment
Share on other sites

On 9/23/2017 at 3:31 AM, Lurker said:

pake arcgis berapa?

https://gis.stackexchange.com/questions/212722/arcgis-crashing-with-tkinter

ane bukan programmer jadi bantu2 searching aja untuk trouble sejenis

intinya pada kompatibilitas untuk tkinter

dev di 10.5,

usernya di 10.2.2 -10.5

makasih bang infonya, ternyata di wxpython sama tkinter kalau di arcgis emang kayanya ga bisa pake close button window.


 

terimakasih

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.

Disable-Adblock.png

 

If you enjoy our contents, support us by Disable ads Blocker or add GIS-area to your ads blocker whitelist