Â
Â
How can I make the feature as a global variable?Â
Â
import fmeobjectsÂ
import jsonÂ
import matplotlib.pyplot as pltÂ
from matplotlib.widgets import ButtonÂ
from descartes import PolygonPatchÂ
Â
     ÂÂ
def checkViewer(feature):Â
   BLUE = '#6699cc'Â
   geometry = feature.getAttribute('_geometry')Â
   geoJson = json.loads(geometry)Â
   fig = plt.figure()Â
   ax = fig.gca()Â
   ax.add_patch(PolygonPatch(geoJson, fc=BLUE, ec=BLUE, alpha=0.5, zorder=2 ))Â
   ax.axis('scaled')Â
  ÂÂ
   callback = Index()Â
   axprev = plt.axes(Â0.7, 0.05, 0.1, 0.075])Â
   axnext = plt.axes(e0.81, 0.05, 0.1, 0.075])Â
   bnext = Button(axnext, 'Garder')Â
   bnext.on_clicked(callback.garder)Â
   bprev = Button(axprev, 'Rejeter')Â
   bprev.on_clicked(callback.rejeter)Â
  ÂÂ
   plt.show()Â
Â
Â
class Index():Â
   def __init__(self):Â
       self.feature = featureÂ
      ÂÂ
   def gader(self, event):Â
       plt.close()Â
       feature.setAttribute('check', "yes") #this is not working because feature is not globalÂ
Â
   def rejeter(self, event):Â
       plt.close()Â
       feature.setAttribute('check', "no") #this is not working