title: Tkinter Button getting a Button to Accept Valid Args
body: <p>As it stands the code in the below line is not accepting the Tkinter Entry variables <code>price_range</code>, <code>num_of_beds</code>, and <code>county</code> above it. I have tried several different configurations but to no avail. The logic here is that these variables will be called by a function that exists above the class (this portion does work fine). I am noticing that the <code>price_range</code> variable is stored as PY_VAR0 but the <code>.get()</code> doesn't seem to resolve this issue. The line in question:</p>
  <pre><code> Button(window, text=&quot;Run Program!&quot;, command= lambda : run1.runBot(str(price_range.get()), str(num_of_beds.get()), str(county.get()))).grid(row=7,column=2, padx= (60,5), pady=5)
  </code></pre>
  <p>The traceback:</p>
  <pre><code>Button(window, text=&quot;Run Program!&quot;, command= lambda : run1.runBot(str(price_range.get()), str(num_of_beds.get()), str(county.get()))).grid(row=7,column=2, padx= (60,5), pady=5)
  
  NameError: name 'price_range' is not defined
  </code></pre>
  <p>The code:</p>
  <pre><code>from selenium import webdriver
  from getpass import getpass
  from selenium.webdriver.common.keys import Keys
  from selenium.webdriver.common.by import By
  from selenium.webdriver.support.ui import WebDriverWait
  from selenium.webdriver.support import expected_conditions as EC
  import time
  
  username = ********
  password = &quot;*********&quot;
  
  class Bot:
      def runBot(self, price_range, num_of_beds, county):
  
          driver = webdriver.Chrome(&quot;C:\\Users\\Matt\\Documents\\WebDriver\\chromedriver_win32\\chromedriver.exe&quot;)
          #profile = webdriver.Chrome(&quot;C:\\Users\\Matt\\Documents\\WebDriver\\chromedriver_win32\\chromedriver.exe&quot;)
  
          options = webdriver.ChromeOptions()
          options.add_argument(&quot;--start-maximized&quot;)
          prefs = {&quot;profile.default_content_settings.popups&quot;: 1,
                       &quot;download.default_directory&quot;: 
                                  &quot;C:\\Users\\Matt\\Documents\\Splitt&quot;,
                       &quot;directory_upgrade&quot;: True}
          
          options.add_experimental_option(&quot;prefs&quot;, prefs)
          driver=webdriver.Chrome('C:\\Users\\Matt\\Documents\\WebDriver\\chromedriver_win32\\chromedriver.exe', options=options)
          driver.get(&quot;https://www.stellarmls.com/&quot;)
          driver.maximize_window()
  
  
          username_textbox = driver.find_element_by_id(&quot;loginid&quot;)
          username_textbox.send_keys(username)
  
          password_textbox = driver.find_element_by_id(&quot;password&quot;)
          password_textbox.send_keys(password)
  
          login_button = driver.find_element_by_id(&quot;dropdownMenuButton&quot;)
          login_button.submit()
  
          tab_url = 'https://dashboard.stellarmls.com/layouts'
          driver.switch_to.window(driver.window_handles[1])
  
          driver.get(tab_url)
  
          tab_url = 'https://stellar.mlsmatrix.com/matrix/?f='
          driver.switch_to.window(driver.window_handles[1])
          driver.get(tab_url)
  
          tab_url = 'https://stellar.mlsmatrix.com/Matrix/Search/Residential/Quick'
          driver.switch_to.window(driver.window_handles[1])
          driver.get(tab_url)
          
  
          driver.find_element_by_id('Fm23_Ctrl88_TB').send_keys(price_range)
          driver.find_element_by_id('Fm23_Ctrl99_TB').send_keys(num_of_beds)
          driver.find_element_by_id('Fm23_Ctrl2096_LB_TB').send_keys(county)
          driver.find_element_by_xpath('//*[@id=&quot;m_ucResultsPageTabs_m_lbMapTab&quot;]/span/i').click()
  
  run1 = Bot()
  
  
  class PropertyCalculator:
  
      window = Tk()
      window.title(&quot;MLS Property ROI Calculator&quot;)
      
      Label(window, text=&quot;Price Range (ex: 100-400)&quot;).grid(row=1, column=1, sticky=W)
      Label(window, text=&quot;Number of Bedrooms&quot;).grid(row=2, column=1, sticky=W)
      #TODO: create town filter
      Label(window, text=&quot;County&quot;).grid(row=3, column=1, sticky=W)
      Label(window, text=None).grid(row=4,column=1) # space between inputs and outputs
      
      #Variables to store inputs
      price_range = StringVar()
      num_of_beds = StringVar()
      county = StringVar()
  
  
              
      #Text boxes to hold inputs and outputs
      ttk.Entry(window, textvariable = price_range,
            justify=RIGHT).grid(row=1,column=2, padx=(0,5))
      ttk.Entry(window, textvariable = num_of_beds, 
            justify=RIGHT).grid(row=2,column=2)
      ttk.Entry(window, textvariable = county, 
            justify=RIGHT).grid(row=3,column=2)
      print(&quot;the price: &quot;, price_range)
  
      Button(window, text=&quot;Run Program!&quot;, command= lambda : run1.runBot(price_range.get(),num_of_beds.get(), county.get())).grid(row=7,column=2, padx= (60,5), pady=5)
      window.mainloop()
  
  
  execute(window)
  WebDriverWait(driver, 6).until(EC.element_to_be_clickable((By.XPATH, '//*[@id=&quot;m_lnkCheckAllLink&quot;]'))).click()
  WebDriverWait(driver, 6).until(EC.element_to_be_clickable((By.XPATH, '//*[@id=&quot;m_lbExport&quot;]/span'))).click()
  WebDriverWait(driver, 6).until(EC.element_to_be_clickable((By.XPATH, '//*[@id=&quot;m_ddExport&quot;]'))).send_keys('m')
  WebDriverWait(driver, 6).until(EC.element_to_be_clickable((By.XPATH, '//*[@id=&quot;m_btnExport&quot;]'))).click()
  </code></pre>