Green Light Coding presents a new video which shows to search any selected or highlighted strings of any text editors or code spaces in google using python ?
-- Scroll below to get the code --
Watch the full video and code it yourself .
people searches for:
python programming, python tkinter, google search using python, python google search, tkinter python tutorial, tkinter tutorial python, python, tkinter, tkinter python, python IDLE
_____________________________________________________________
Stay connected to us for more necessary coding tricks like these.
_____________________________________________________________
code:
from googletrans import Translator
import tkinter as tk
from tkinter.simpledialog import askstring
import os
t=tk.Tk()
t.geometry("800x600")
tb = tk.Text(t, height=14, width=60, insertbackground="red", undo=True )
tb.configure(font=("arial", 17, "bold"), bd=5, fg="black", bg="white")
tb.place(x=5, y=10)
tb["wrap"]="word"
t.title("SEARCH HIGHLIGHTED TEXT")
t.config(bg="darkblue")
translator = Translator()
def google():
s=tb.index("sel.first")
l=tb.index("sel.last")
tb.tag_add("sel", s, l)
k=tb.selection_get()
ar=list(map(str, k.split(" ")))
n=""
for i in ar:
n=n+i+"+"
fs=n+""
txf=open("storedstrings.txt", "w")
txf.write(fs)
txf=open("storedstrings.txt", "r")
lines = txf.readlines()
mystr = '+'.join([line.strip() for line in lines])
os.system("start msedge www.google.com/search?q="+mystr)
def translation():
translated_text = translator.translate(tb.selection_get(), dest=askstring("Language","Mention the code: (en,bn,ja,...)"))
tb.insert(tk.END, translated_text.text)
btt=tk.Button(t, text="Translate", font=("verdana", 14, "bold"), fg="black", bg='white', height=0, width=10,command = translation)
btt.place(x=500,y=415)
btg=tk.Button(t, text="Google Search", font=("verdana", 14, "bold"), fg="black", bg='white', height=0, width=12,command = google)
btg.place(x=200,y=415)
________________________________________________________
#coding #codinglife #python #pythonprogramming #pythontutorial #pythonforbeginners #commandprompt #primenumber
#fontsize #cmd #functions #console #programming #programminglife
#google #googling #googlesearch #texteditor #tkinter #tkintertutorial #pythontkinter #chrome #edge #visualstudio
LINK FOR BATCH SERIES PLAYLIST :
/ @greenlightcoding613
_______________________________________________________________
SUBSCRIBE FOR MORE UPDATES LIKE THESE
_______________________________________________________________
CHANNEL LINK : / @greenlightcoding613
_______________________________________________________________
Информация по комментариям в разработке