I am using this code set called pythonaddin_interval_caller (written by Jason Scheirer) to do some map refresh every several seconds. The code was designed for arcgis python-addin. The benefit of this code is that it does the auto-check work without creating a separate thread.
import tickextension.call_later
import arcpy
class Refresher(tickextension.call_later.CallQueue):
def __init__(self):
super(Refresher, self).__init__()
self.call_later(self.refresh_view, 2)
def refresh_view(Refresher):
arcpy.RefreshActiveView()
Refresher.call_later(Refresher.refresh_view, 2)
refresh_ob = Refresher()
refresh_ob.refresh_view()
This code is for python add-in. For some reason, I don't have permission to create add-in at this time. So I ran the script in arcmap python command window, I did two tests:
- The original code only refreshed once, then, stopped. No error
- I changed refresh_ob.refresh_view() to refresh_ob.refresh_view(refresh_ob), it throws the "takes exactly 1 argument (2 given) arcpy" error. I know its because I should not pass the object of self as the first argument. However, the program continued to run and did the auto-refresh every 2 seconds. The program works perfectly except this error message.
Are there any solutions to fix this?