title: variable not defined in range
body: <p>I am just start learning Python today because I need to create a macro in PARAVIEW. 
  I have several grid files which name is namefile.timestep (ex: p3d.030000)
  I want to open this PLOT3D files with a macro, take a picture of the grid and then create a movie with these pictures.</p>
  
  <p>The first thing that I need to know to open these files is their names (including the path ex: home/enrico/desktop/p3d.030000).
  I want a macro that open a GUI in which I insert the folder path, the root name of the files (ex:p3d) and the time steps (I give the first time step, the interval and the number of files). Whit these data I can create the complete paths. Then I will open them one at the time to create a snapchat and save this figure in a file .png. 
  Then with this picture I will create a movie (still to figure out how)
  I am stuck with the construction of the complete folder path. The code tell me that a variable firsttimestep is not defined inside the for cycle.</p>
  
  <p>I do not know what I am doing wrong. Probably is a simple problem, but I am a beginner.
  Thanks for your help</p>
  
  <pre><code>#simple GUI
  from Tkinter import *
  
  class Application(Frame):
  
   def __init__(self,master):
      "Initialize the Frame"
      Frame.__init__(self,master)
      self.grid()
      inp=self.create_widgets()
  
   def create_widgets(self):  
      self.instruction=Label(self, text="Enter the folder PATH")
      self.instruction.grid(row=0,column=0,columnspan=2,sticky=W)
      self.path=Entry(self)
      self.path.grid(row=1,column=1,sticky=W)
  
      self.instruction=Label(self, text="Enter the PLOT3D file name")
      self.instruction.grid(row=3,column=0,columnspan=2,sticky=W)
      self.plot3dname=Entry(self)
      self.plot3dname.grid(row=4,column=1,sticky=W)
  
      self.instruction=Label(self, text="Enter number of solution and grid files")
      self.instruction.grid(row=5,column=0,columnspan=2,sticky=W)
      self.numfiles=Entry(self)
      self.numfiles.grid(row=6,column=1,sticky=W)
  
      self.instruction=Label(self, text="Enter time step interval")
      self.instruction.grid(row=7,column=0,columnspan=2,sticky=W)
      self.numtimestep=Entry(self)
      self.numtimestep.grid(row=8,column=1,sticky=W)   
  
      self.instruction=Label(self, text="Enter first time step")
      self.instruction.grid(row=9,column=0,columnspan=2,sticky=W)
      self.firsttimestep=Entry(self)
      self.firsttimestep.grid(row=10,column=1,sticky=W)
  
      self.save_button=Button(root, text="Save input", command=self.save)
      self.save_button.grid(row=11,column=0,sticky=W)
  
      self.quit_button=Button(root, text="Quit", command=quit)
      self.quit_button.grid(row=12,column=0,sticky=W)
  
   def save(self):
       pathvalue    =self.path.get()       
       plot3dname   =self.plot3dname.get()    
       numfiles     =int(self.numfiles.get())
       stepinterval =int(self.numtimestep.get())  
       firsttimestep=int(self.firsttimestep.get())
       print(pathvalue)
       print(plot3dname)
       print(numfiles)
       print(stepinterval)     
       print(firsttimestep)       
       # create root file name 
       RootGridName=pathvalue + '.'+ plot3dname
       for x in range(firsttimestep,laststep,stepinterval):
           s="{:06d}".format(x)
           # Filename rooth.num ex:  '/usr/bin/p3d.010000'
           FileName = RootGridName + s
           print(FileName)
  
   def quit():
       root.destroy()          
  
   root =Tk()
   root.title("Path")
   root.geometry("400x400")
   app=Application(root)
   root.mainloop()
  </code></pre>
  
  <p>When compile I receive the error:</p>
  
  <pre><code>for x in range(firsttimestep,laststep,stepinterval):
  NameError: name 'firsttimestep' is not defined
  </code></pre>