Issue
I just started learning software development with GUI elements and so far I have managed to come up with this program, that the only thing it does is to create a GUI element that has a button which opens a new chrome window when clicked:
import tkinter as tk #
import subprocess
import os
import sys
root = tk.Tk()
root.geometry('500x400')
root.title("Bulk upload to OpenSea")
main_directory = os.path.join(sys.path[0])
def open_chrome_profile():
subprocess.Popen(
[
"start",
"chrome",
"--remote-debugging-port=8989",
"--user-data-dir=" + main_directory + "/chrome_profile",
],
shell=True,
)
#####BUTTON ZONE#######
open_browser = tk.Button(root, width=20, text="Open Chrome Browser", command=open_chrome_profile)
open_browser.grid(row=22, column=1)
root.mainloop()
GUI preview:
Result after clicking the "Open Chrome Browser" button:
However, I noticed that the chrome browser deployed is not the real one I use, I know that it uses the statement "--user-data-dir=" + main_directory + "/chrome_profile"
to deploy a driver-like version of my browser, but I don't know how could I get the corresponding path (and its profile) to my actual chrome browser.
How should the function open_chrome_profile()
be changed in order to open a new tab in my actual chrome browser?
Solution
You can simply use webbrowser
module:
webbrowser.open_new_tab('https://google.com')
Answered By - acw1668
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.