Jump to content

Our forum made possible by displaying online advertisements to our visitors.

Please consider supporting us by disabling your ads blocker.

  • Announcements

    • EmperoR

      Dear Guests   12/24/2016

      Welcome to the GIS-AREA. like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be a part of GIS-AREA by signing in or creating an account here. Once you have created your account and have introduced yourself to our community, you can start new topics, reply to others, subscribe interesting threads, get your customize profiles, make news friends, and others nice stuff. To make your stay as pleasant and constructive as possible, please don't forget to read through our pinned forum rules and board guidelines in each section before you do anything else.
Sign in to follow this  
asnaeb

[TANYA] Arcgis python Add in

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

ehehehe, nanti kalo dah ketemu solusinya n rampung pluginnya bisa cerita-cerita dimarih yah ehehehehe

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×

Important Information

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