Friday, September 22, 2023

Prompt for Python code for creating a webbrowser

CursorAI Prompt: Python code for creating a webbrowser

import tkinter as tk
from tkinter import messagebox
import webbrowser

def open_url():
url = entry.get()
webbrowser.open_new(url)

root = tk.Tk()
root.title("Web Browser")

label = tk.Label(root, text="Enter URL")
label.pack()

entry = tk.Entry(root)
entry.pack()

button = tk.Button(root, text="Go", command=open_url)
button.pack()

root.mainloop()


0 Comments: