The code works fine in IDLE, but when double-clicking the file or running from the command line the rest of the program doesn't seem to work, as my key handler does not react to key presses. I believe it may have something to do with chromedriver taking over the cmd window, but I am fairly new to python and I am not sure. Attached is the code, and it will open the chromedriver window and not bind the key presses which it would bind in IDLE:
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import Select
import keyboard
from tkinter import *
from tkinter import messagebox
address = {}
chrome_options = webdriver.ChromeOptions();
chrome_options.add_experimental_option("excludeSwitches", ['enable-automation'])
chrome_options.add_argument("--disable-extensions")
chromeDriverPath = 'C:/ChromeDriver/chromedriver.exe'
def keyboardHandler(keyboardEvent):
if keyboardEvent.name == "f7":
copyAddress(driver)
elif keyboardEvent.name == "f9":
paste(driver)
#Script will launch browser when f7 is pressed
keyboard.wait('f7')
driver = webdriver.Chrome(chromeDriverPath, options=chrome_options)
driver.get('http://www.ebay.co.uk/')
keyboard.on_press(keyboardHandler)