Advertisement
Guest User

Google_Tool

a guest
Nov 22nd, 2020
1,160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. import pyperclip
  2. import webbrowser
  3. import tkinter as tk
  4.  
  5. def google_input(inp):
  6.     webbrowser.open("https://google.com/search?q=%s" % inp)
  7.     pass
  8.  
  9. def google_clipboard():
  10.     copied_query = pyperclip.paste()
  11.     webbrowser.open("https://google.com/search?q=%s" % copied_query)
  12.     pass
  13.  
  14.  
  15. root= tk.Tk()
  16.  
  17. canvas1 = tk.Canvas(root, width = 400, height = 300)
  18. canvas1.pack(fill = "both", expand= True)
  19.  
  20. entry1 = tk.Entry (root)
  21. canvas1.create_window(200, 140, window=entry1)
  22. canvas1.config(background="#024897")
  23.  
  24. def google_entry():
  25.     entry_information = entry1.get()
  26.     if entry_information == '':
  27.         google_clipboard()
  28.     else:
  29.         google_input(entry_information)    
  30.    
  31. button1 = tk.Button(text='Search Google', command=google_entry)
  32. canvas1.create_window(200, 180, window=button1)
  33.  
  34. root.mainloop()
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement