So I planned to make a GUI for my application which contains several buttons.
Each button will open chrome browser and redirect to specific URLs.
So this is my sample GUI code, but will enhance the code to look more perfect.
I think I'll use another application to create the fancy GUI and to trigger the .py/.exe file. (1 button will trigger 1 .py/.exe file)
So there are few things I wanna do ask.
Each button will open chrome browser and redirect to specific URLs.
So this is my sample GUI code, but will enhance the code to look more perfect.
from tkinter import * from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys import time window = Tk() window.title("Welcome to MyApp") window.geometry('350x200') def google(): chrome_options = Options() chrome_options.add_argument("--disable-infobars") chrome_options.add_argument("--headless") chrome_options.add_argument('--disable-gpu') chrome_options.add_argument('--log-level=3') driver = webdriver.Chrome(executable_path=r'chromedriver.exe') driver.get("https://www.google.com") btnGoogle = Button(window, text="Google", command=google) btnGoogle.grid(column=0, row=0) def yahoo(): chrome_options = Options() chrome_options.add_argument("--disable-infobars") chrome_options.add_argument("--headless") chrome_options.add_argument('--disable-gpu') chrome_options.add_argument('--log-level=3') driver = webdriver.Chrome(executable_path=r'chromedriver.exe') driver.get("https://malaysia.yahoo.com/?p=us") btnYahoo = Button(window, text="Yahoo", command=yahoo) btnYahoo.grid(column=1, row=0) window.mainloop()EDIT
I think I'll use another application to create the fancy GUI and to trigger the .py/.exe file. (1 button will trigger 1 .py/.exe file)
So there are few things I wanna do ask.
- How to launch default google chrome browser instead of chromedriver.exe (To avoid the pop-up window when executed chromedriver.exe)
- How to launch as new tab and redirect to specific URLs, if the chrome browser is already opened, else open new browser window.
- How to convert .py to .exe file