arcgis怎么用python重新排序_使用Python实现ArcGIS中的自动刷新

我正在尝试为ArcMap创建一个“自动刷新”工具,以刷新数据帧。我相信版本10有一个附加组件,你可以为此下载。。不过,我们现在运行的是10.1版本,没有这样的工具。在

编辑wxPython的计时器应该可以工作,但是在arc中使用wx是很棘手的。下面是当前的代码:import arcpy

import pythonaddins

import os

import sys

sMyPath = os.path.dirname(__file__)

sys.path.insert(0, sMyPath)

WATCHER = None

class WxExtensionClass(object):

"""Implementation for Refresher_addin.extension (Extension)"""

_wxApp = None

def __init__(self):

# For performance considerations, please remove all unused methods in this class.

self.enabled = True

def startup(self):

from wx import PySimpleApp

self._wxApp = PySimpleApp()

self._wxApp.MainLoop()

global WATCHER

WATCHER = watcherDialog()

class RefreshButton(object):

"""Implementation for Refresher_addin.button (Button)"""

def __init__(self):

self.enabled = True

self.checked = False

def onClick(self):

if not WATCHER.timer.IsRunning():

WATCHER.timer.Start(5000)

else:

WATCHER.timer.Stop()

class watcherDialog(wx.Frame):

'''Frame subclass, just used as a timer event.'''

def __init__(self):

wx.Frame.__init__(self, None, -1, "timer_event")

#set up timer

self.timer = wx.Timer(self)

self.Bind(wx.EVT_TIMER, self.onTimer, self.timer)

def onTimer(self, event):

localtime = time.asctime( time.localtime(time.time()) )

print "Refresh at :", localtime

arcpy.RefreshActiveView()

app = wx.App(False)

你会注意到里面有PySimpleApp的东西。我从塞德霍姆的演讲中得到的。我想知道我是否误解了什么。我应该为扩展创建一个完全独立的加载项吗?然后,用我需要的代码创建我的工具栏/工具栏加载项?我这么问是因为我没有看到下面代码中引用的PySimpleApp,或者在startup override方法中没有从wx导入任何内容。。。我认为这是必要的/这一切的重点。我非常感谢你的帮助。请告诉我你在我的代码中看到了什么。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值