title: Use variables outside of function
body: <p>I have defined a function that will get a value from the user input. It's a path (based on the appJar's .directoryBox). I have put the code for the directory box to popup inside a function so that it will show when a button is pressed. However, I cannot seem to use the value outside of the function. </p>
  
  <p>The important part of the code looks like this:</p>
  
  <pre><code>def dirfunction(button):
      dirr = app.directoryBox('box')
      app.setEntry('Directory', dirr)
      app.showButton('Search')
      return dirr
  
  def searchfunction(button):
      if button == 'Search':
          findBigfile.findBigFiles(dirr, mbSize)
  
  
  mbSize = app.addLabelEntry('Size in MB')
  app.addLabelEntry('Directory')
  app.setLabelWidth('Size in MB', '10')
  app.setLabelWidth('Directory', '10')
  
  app.addButton('Choose Directory', dirfunction)
  app.addButton('Search', searchfunction)
  app.hideButton('Search')
  
  app.go()
  </code></pre>
  
  <p>I try to use the 'dirr' variable outside of the dirfunction, but I cannot make it work. It only works within. </p>
  
  <p>EDIT: I also cannot make the app.directoryBox outside of the function, as that will cause that popup to occur directly when the app is opened. </p>