I've not had much call in developing Python AddIns but what you were asking is something I would have approached in VB .net using an extension with an event firing on something specific.
If you look at the help file you can create a Python add-in application extension. This can hook into various events, an obvious one is on openDocument() or possibly contentsChanged(); you could get the combobox to refresh on that.
As I've never developed a Python AddIn what I am unsure about and hopefully someone can confirmBelow is how one hooks intoa basic outline of me adding things to the comboboxlist, in your python addIn toolbarcase you would use your code to read from the Application extensionyour text file. I hook into 3 events to update itimprove the regular updating of the combobox.
import arcpy
import pythonaddins
class myComboBoxClass(object):
"""Implementation for PythonAddIns_addin.combobox (ComboBox)"""
def __init__(self):
self.items = ["item1", "item2"]
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'
def onSelChange(self, selection):
pass
def onEditChange(self, text):
pass
def onFocus(self, focused):
# Add text to list on click of control as suggested by Kadir
if focused:
self.items.append("Click me!")
def onEnter(self):
pass
def refresh(self):
pass
class myExtensionClass(object):
"""Implementation for PythonAddIns_addin.extension2 (Extension)"""
# Note to access the combobox I use the name after the full stop in PythonAddIns_addin.combobox, so combobox
def __init__(self):
# For performance considerations, please remove all unused methods in this class.
self.enabled = True
def openDocument(self):
combobox.items.append("FUNKY")
def contentsChanged(self):
combobox.items.append("WOMBAT")
def itemAdded(self, new_item):
combobox.items.append("ROBOT")