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):

          Refresher.call_later(Refresher.refresh_view, 2)

   refresh_ob = Refresher()

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:

  1. The original code only refreshed once, then, stopped. No error
  2. 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?

  • Derived from gis.stackexchange.com/questions/154313/… can we get a link to the pythonaddin_interval_caller please. I'm fairly certain that the tickextension creates a new thread but can't say for sure. I did once write a timer refresh in VB that worked but only while the tool was active (so you couldn't do anything else at the same time). If you wrote a python add-in tool you could emulate the behavior of that. Commented Jul 16, 2015 at 21:56
  • github.com/jasonbot/pyaddin-interval-caller. Actually I can do whatever actions on the main window while this is running. like zoom in/out, check/uncheck visibility, etc.
    – zheng
    Commented Jul 16, 2015 at 22:43


Browse other questions tagged or ask your own question.