コード例 #1
0
    def convert(self):

        if self.txt_file.text():

            if self.txt_dest.text():

                try:
                    self.progressBar.setValue(10)
                    self.progressBar.setValue(20)

                    #main logic
                    data = Path(self.file).read_text()

                    self.progressBar.setValue(30)
                    data = data.replace('\n', ' ')
                    data = data.strip()
                    self.progressBar.setValue(40)
                    self.progressBar.setValue(50)
                    self.folder += "/writing.png"
                    kit.text_to_handwriting(data, self.folder)
                    self.progressBar.setValue(50)
                    self.progressBar.setValue(80)
                    self.progressBar.setValue(100)

                    showdialog("process completed")
                    self.txt_dest.setText("")
                    self.txt_file.setText("")
                    self.progressBar.setValue(0)

                except:
                    showdialog(
                        "file access denied! Please go and change permissions")
                    self.txt_dest.setText("")
                    self.txt_file.setText("")
                    self.progressBar.setValue(0)

            else:
                showdialog("select folder for conversation")
                self.txt_dest.setText("")
                self.counter = 0

        else:
            showdialog("select text file for conversation")
            self.txt_file.setText("")
            self.counter = 0

        pass
コード例 #2
0
def choose_color_and_save():
    color = askcolor(title="Tkinter Color Chooser")
    color0 = [int(i) for i in color[0]]  #store the rgb format of color

    folder = filedialog.askdirectory(initialdir=os.path.normpath("C://"),
                                     title="Choose folder")
    folder = folder.split("/")
    folder = "//".join(folder)
    location = folder + "/" + e1.get(
    ) + ".png"  #path and name of file to be saved

    content = tb1.get("1.0", "end")  #the text given as input

    pywhatkit.text_to_handwriting(content, location,
                                  color0)  #generate and save handwriting

    l3.config(text="!!!File Saved Successfully ... Check it out!!!")
コード例 #3
0
def convert_txt_to_HW():
    text = txt2.get("1.0", END)
    ts = time.time()
    dat = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d')
    timeStam = datetime.datetime.fromtimestamp(ts).strftime('%H:%M:%S')
    Hour, Minute, Second = timeStam.split(":")
    fileN = "./results/" + dat + "_" + Hour + "-" + Minute + "-" + Second + ".png"
    img_txt = kit.text_to_handwriting(text, fileN, rgb=color_result_rgb)

    def bar():
        progress['value'] = 20
        windo.update_idletasks()
        time.sleep(1)
        progress['value'] = 40
        windo.update_idletasks()
        time.sleep(1)
        progress['value'] = 60
        windo.update_idletasks()
        time.sleep(1)
        progress['value'] = 80
        windo.update_idletasks()
        time.sleep(1)
        progress['value'] = 100
        windo.update_idletasks()
        progress.destroy()

    progress = Progressbar(windo,
                           orient=HORIZONTAL,
                           length=100,
                           mode='determinate')
    progress.place(x=770, y=652)
    bar()

    conv_text_lbl.config(text="Handwritten Text",
                         width=15,
                         height=2,
                         fg="#00FF89",
                         bg="blue",
                         font=('segou UI', 16, ' bold'))
    conv_text_lbl.place(x=990, y=157)

    im2 = PIL.Image.open(fileN)
    im2 = im2.resize((887, 402), PIL.Image.ANTIALIAS)
    sp_img2 = ImageTk.PhotoImage(im2)
    panel6.config(image=sp_img2)
    panel6.image = sp_img2
    panel6.pack()
    panel6.place(x=1005, y=237)
コード例 #4
0
        elif "news" in query:
            speak("News For Today....let's begin")
            url = "https://newsapi.org/v2/top-headlines?sources=techcrunch&apiKey=41e578ed35ce478aaf72c4cf7a9d1763"
            news = requests.get(url).text
            news_dict = json.loads(news)
            print(news_dict["articles"])
            arts = news_dict['articles']
            for article in arts:
                speak(article['title'])
                speak("moving on the next news")
            speak("Thanks for you time u were a great listener")

        elif "sleep" in query:
            speak("sleep mode on")
            computer_sleep()

        elif "search" in query:
            command = takeCommand()
            result = command.replace("search", "")
            pywhatkit.search(result)
            speak("searching" + result)

        elif "hello" in query:
            command = takeCommand()
            handWritten = command.replace("write", "")
            pywhatkit.text_to_handwriting(handWritten, rgb=[0, 0, 0])
            speak("writing" + handWritten)
        elif "stop" in query:
            break
コード例 #5
0
# convert text into the handwritten text using Python

import pywhatkit as kit

import cv2

kit.text_to_handwriting("Python is awesome programming",save_to='myhandwriting.png')

img= cv2.imread('myhandwriting.png')
cv2.imshow("Text To handwriting",img)

cv2.waitKey(0)

cv2.destroyAllWindows() 




コード例 #6
0
import pywhatkit
pywhatkit.text_to_handwriting("Eu amo muito minha família!", rgb=(0, 0, 0))
コード例 #7
0
ファイル: manuscrito.py プロジェクト: Luuquicas/Aulas-LP
import pywhatkit as Kit

messageOne = f'Ola\nMeu nome eh Luccas!\n'
messageTwo = f'Tenho 19 anos!\nE faco Ciencia da Computacao'
Kit.text_to_handwriting(messageOne + messageTwo)

コード例 #8
0
# pip install pywhatkit
import pywhatkit

text = input("enter the text here: ")
pywhatkit.text_to_handwriting(text, rgb=[0, 255, 0])
コード例 #9
0
import pywhatkit as kit
import cv2

kit.text_to_handwriting("Hello, Welcome to Text to Handwriting Program.",
                        save_to="handwriting.png")
img = cv2.imread("handwriting.png")
cv2.imshow("Text to Handwriting", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
コード例 #10
0
import pywhatkit as kt

kt.text_to_handwriting("Hi User", rgb=[0, 0, 0])
コード例 #11
0
ファイル: alexa.py プロジェクト: vimal0312/alexa
def run_alexa():
    command = take_command()
    print(command)
    if 'music' in command:
        song = command.replace('play song', '')
        talk('I am playing your favourite ' + song)
        # print('playing')
        print(song)
        # playing the first video that appears in yt search
        pywhatkit.playonyt(song)

    elif 'time' in command:
        now = datetime.now()
        time = now.strftime("%H:%M:%S")
        print("time:", time)
        talk("Current time is " + time)

    elif ('month' or 'year') in command:
        now = datetime.now()
        year = now.strftime("%Y")
        print("year:", year)
        talk("Current year is  " + year)
        month = now.strftime("%m")
        print("month:", month)
        talk("Current month is  " + month)

    elif 'date' in command:
        now = datetime.now()
        date_time = now.strftime("%m/%d/%Y, %H:%M:%S")
        print("date and time:", date_time)
        talk("Current date and time is " + date_time)

    # opens web.whatsapp at specified time i.e before 10 minutes and send the msg
    elif 'whatsapp' in command:
        talk("To which number do you have to whatsapp")
        talk("Please dont forget to enter 10 digits with country code")
        num = input()
        talk("Enter the message you have to send")
        msg = input()
        talk("Enter the time to send the message")
        time = int(input())
        pywhatkit.sendwhatmsg(num, msg, time, 00)
        pywhatkit.showHistory()
        pywhatkit.shutdown(3000000000)
        # pywhatkit.sendwhatmsg("+919876543210", "This is a message", 15, 00)

    # Convert text to handwritten format
    elif 'convert' in command:
        text = command.replace('convert', '')
        pywhatkit.text_to_handwriting(text, rgb=[0, 0, 0])

    # Perform google search
    elif 'search' in command:
        key = command.replace('search', '')
        pywhatkit.search("key")

    elif 'wikipedia' in command:
        person = command.replace('wikipedia', '')
        talk("How many pages do you want to read")
        num_pages = int(input())
        # talk("In which language do you want to read")
        # l = input()
        # wikipedia.set_lang(l)
        info = wikipedia.summary(person, num_pages)
        print(info)
        talk(info)

    elif 'can you work for me' in command:
        talk("sorry, I have headache. Please do your work")

    elif 'are you single' in command:
        talk("I am in relationshhip with wifi")

    elif 'joke' in command:
        talk(pyjokes.get_joke())
        talk("sorry for the lamest joke")

    elif 'open google browser' in command:
        try:
            urL = 'https://www.google.com'
            chrome_path = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
            webbrowser.register('chrome', None,
                                webbrowser.BackgroundBrowser(chrome_path))
            webbrowser.get('chrome').open_new_tab(urL)
            talk("Successfully opened chrome its upto you to search")
        except:
            webbrowser.Error

    elif 'google search' in command:
        word_to_search = command.replace('google search', '')
        response = GoogleSearch().search(word_to_search)
        print(response)
        for result in response.results:
            print("Title: " + result.title)
            talk("You can look for the following titles  " + result.title)

    elif 'weather' in command:
        # base URL
        BASE_URL = "https://api.openweathermap.org/data/2.5/weather?"
        talk("Which city weather are you looking for")
        try:
            with sr.Microphone() as source:
                print('listening weather...')
                city_voice = listener.listen(source)
                city = listener.recognize_google(city_voice)
                # city = '\"'+city.lower()+'\"'

                print(city)
                # city="bangalore"
                # API key API_KEY = "Your API Key"
                API_KEY = "b5a362ef1dc8e16c673dd5049aa98d8f"
                # upadting the URL
                URL = BASE_URL + "q=" + city + "&appid=" + API_KEY
                # HTTP request
                response = requests.get(URL)
                # checking the status code of the request
                if response.status_code == 200:
                    # getting data in the json format
                    data = response.json()
                    # getting the main dict block
                    main = data['main']
                    # getting temperature
                    temperature = main['temp']
                    # getting the humidity
                    humidity = main['humidity']
                    # getting the pressure
                    pressure = main['pressure']
                    # weather report
                    report = data['weather']
                    print(f"{CITY:-^30}")
                    print(f"Temperature: {temperature}")
                    print(f"Humidity: {humidity}")
                    print(f"Pressure: {pressure}")
                    print(f"Weather Report: {report[0]['description']}")
                    talk("Temperature in " + city + " is " + temperature +
                         " humidity is " + humidity + " pressure is " +
                         pressure + " and your final weather report" + report)
                else:
                    # showing the error message
                    print("Error in the HTTP request")
                    talk("Error in the HTTP request")
        except:
            talk("Hmmmmm, it looks like there is something wrong")

    elif 'news' in command:
        try:
            googlenews = GoogleNews()
            googlenews.set_lang('en')
            # googlenews.set_period('7d')
            # googlenews.set_time_range('02/01/2020', '02/28/2020')
            googlenews.set_encode('utf-8')

            talk("What news are you looking for")
            try:
                with sr.Microphone() as source:
                    print('listening news ...')
                    news_voice = listener.listen(source)
                    news_input = listener.recognize_google(news_voice)
                    news_input = news_input.lower()
                    print(news_input)
                    googlenews.get_news(news_input)
                    googlenews.search(news_input)
                    googlenews.get_page(2)
                    result = googlenews.page_at(2)
                    news = googlenews.get_texts()
                    print(news)
                    talk(news)
            except:
                print("Error")
                talk("Error in reading input")

        except:
            print("No news")
            talk(" I couldn't find any news on this day")

    elif 'play book' or 'read pdf' in command:
        talk("Which pdf do you want me to read")
        book_input = input()
        print(book_input)
        book = open(book_input, 'rb')
        # create pdfReader object
        pdfReader = PyPDF2.PdfFileReader(book)
        # count the total pages
        total_pages = pdfReader.numPages
        total_pages = str(total_pages)
        print("Total number of pages " + total_pages)
        talk("Total number of pages " + total_pages)
        # initialise speaker object
        # speaker = pyttsx3.init()
        # talk("Enter your starting page")
        # start_page = int(input())
        talk(
            " here are the options for you, you can press 1 to  Play a single page     2 to   Play between start and end points  and  3 to  Play the entire book "
        )
        talk("Enter your choice")
        choice = int(input())
        if (choice == 1):
            talk("Enter index number")
            page = int(input())
            page = pdfReader.getPage(page)
            text = page.extractText()
            talk(text)
            # speaker.say(text)
            # speaker.runAndWait()
        elif (choice == 2):
            talk("Enter starting page number")
            start_page = int(input())
            talk("Enter ending page number")
            end_page = int(input())
            for page in range(start_page + 1, end_page):
                page = pdfReader.getPage(start_page + 1)
                text = page.extractText()
                talk(text)
                # speaker.say(text)
                # speaker.runAndWait()
        elif (choice == 3):
            for page in range(total_pages + 1):
                page = pdfReader.getPage(page)
                text = page.extractText()
                talk(text)
                # speaker.say(text)
                # speaker.runAndWait()
        else:
            talk("Haha!! Please enter valid choice")
    else:
        talk(
            "Hiii Rashika, I am so bored can you please give me some proper commands"
        )
コード例 #12
0
import pywhatkit

print('Convert the text into handwritten\n')
txt = input('Enter the text(paragraph) - \n')
pywhatkit.text_to_handwriting(txt, rgb=[0, 0, 255])
コード例 #13
0
import pywhatkit

text = "Python is an awesome programming language to learn!!"

pywhatkit.text_to_handwriting(text, rgb=(0, 0, 255), save_to="handwriting.png")

print("converted ")
コード例 #14
0
ファイル: Handwriting.py プロジェクト: SimonGideon/Touch
import pywhatkit

pywhatkit.text_to_handwriting(
    "(i.)	ICT has contributed in economic growth in Kenya. "
    "The innovation of mobile money transfer and banking like MPESA as a way of transacting "
    "money through "
    "mobile phone, has facilitated an "
    "easy to send receive money.",
    rgb=(0, 0, 225))
コード例 #15
0
import pywhatkit as pywk

#user input
question = input("Enter the question here :")
answer = input("Enter the Answer here :")

#function
pywk.text_to_handwriting("Question " + "" + question + "\n" + "Answer " + "" +
                         answer,
                         "imagename.png",
                         rgb=[0, 0, 255])
コード例 #16
0
#!/usr/bin/env python3
import pywhatkit as kit
kit.text_to_handwriting("Hello Yuli, what's up?", rgb=[0, 0, 0])
コード例 #17
0
def HANDWRITE(TEXT, DIRECTORY):
    print('[HANDWRITE] gettng image...')
    pywhatkit.text_to_handwriting(TEXT, save_to=DIRECTORY)
    print("[HANDWRITE] Done!")
    messagebox.showinfo('Satus', 'Done!')
コード例 #18
0
import pywhatkit

pywhatkit.text_to_handwriting("hisjvlsv l adskk \ns idfks\n \n fvis fks k",
                              rgb=[0, 0, 0])
コード例 #19
0
import pywhatkit

# For Assignment.txt file text is read
with open('assignment.txt', 'r') as fobj:
    text = fobj.read()

pywhatkit.text_to_handwriting(text, 'assignment.png',
                              rgb=[0, 0, 255])  # Default is set to Blue color
コード例 #20
0
import pywhatkit as kit
import cv2

# Convert Text to Hand Written Text
kit.text_to_handwriting("Hope you are doing well", "handwriting.png",
                        (18, 10, 143))
img = cv2.imread("handwriting.png")

cv2.imshow("Text to Handwriting", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
コード例 #21
0
            speak("showing notes")
            print("showing notes")
            file = open("ayesha.txt", "r")
            print(file.read())
            speak(file.read(6))

        elif "open notepad" in query:
            npath = "C:\\Windows\\system32\\notepad.exe"
            os.startfile(npath)

        elif "handwritten" in query:
            speak("What i should convert?")
            print(("What is hould convert?"))
            h = takeCommand()
            print(h)
            kit.text_to_handwriting(h, rgb=[0, 0, 0])

        elif "open command promot" in query:
            speak("opening..")
            print("opening..")
            os.system("start cmd")

# ERROR : camera not taking picture
        elif "open camera" in query or 'launch camera' in query:
            cap = cv2.VideoCapture(0)
            while True:
                ret, img = cap.read()
                cv2.imshow('webcam', img)
                k = cv2.waitKey(50)
                if k == 27:
                    break
コード例 #22
0
import pywhatkit as pyw

pyw.text_to_handwriting('abbas')
pyw.text_to_handwriting('abbas')
コード例 #23
0
 def text_to_handwritten(self):
     text = input("Enter some random text")
     try:
         kit.text_to_handwriting(text, rgb=(0, 0, 255))
     except Exception as e:
         raise e
コード例 #24
0
#------------------------------------
# Criando texto png com a biblioteca pywhatkit
# Aprendendo a usá-la.
# No momento a mesma não aceita palavras acentuadas.
# Para uso ler a documentação referente a biblioteca.
#
# Tutorial visto no instagram usuário @python.hub
#
# baixei a biblioteca via sudo pip install pywhtkit
#
#------------------------------------

import pywhatkit
pywhatkit.text_to_handwriting(
    "Arquetipos como padrao de comportamento, segundo Jung. Ao que tudo indica, o criador do termo arquetipo foi o psicologo suiço Carl Jung. Para ele, arquetipos sao imagens primordiais, presentes em nosso imaginario, que ajudam a explicar historias passadas, vividas por outras geraçoes.",
    rgb=(0, 0, 255))
コード例 #25
0
ファイル: handwrite.py プロジェクト: Sivapriyak56/program.1
import pywhatkit as py

py.text_to_handwriting("hello\my name is Sivpriya k\i am excited",
                       "D:\handwritten\mee.png")
# -*- coding: utf-8 -*-
"""
Coverting text to handwritten font

@author: DELL Ishvina Kapoor
"""

#importing the module
import pywhatkit as pkt

#displaying a message
print("Converting text to handwriten font")

#the text we need to convert
text = "Hello\nMy name is ABC\nThis code converts the text to a handwriten font"
#calling the function which coverts the text to a handwriten font
#by default the location of the result image will be the same as the folder in which the python script is saved

pkt.text_to_handwriting(text, "texttohandwriting.png")

#will display this message once the image opens successfully
print("Converted!!")
コード例 #27
0
import pywhatkit as pwk

pwk.text_to_handwriting("Hwllo da revanth MAndaiya",
                        "R:\\Code\\Python\\Pywhatkit\\output.png", [20, 10, 0])
コード例 #28
0
import pywhatkit

text = "Web Crawling is all about viewing web pages as a whole and indexing it." \
       "When a crawler (bot) crawls a website, it goes through every page and every link of the website for indexing."
pywhatkit.text_to_handwriting(text, rgb=(0, 0, 255))
コード例 #29
0
# pip install pywhatkit

import pywhatkit

pywhatkit.text_to_handwriting("My name is Prince", rgb=(0, 0, 255))
コード例 #30
0
# pip install pytesseract
# pip install Pillow
# pip install pywhatkit

import os
from PIL import Image  # Importing Pillow module to open image in script
import pytesseract  # Module to using OCR technology
import pywhatkit as kit

# Documentation: https://pypi.org/project/pytesseract/
# Set the Path of Tesseract
pytesseract.pytesseract.tesseract_cmd = r"C:/Users/.../AppData/Local/Programs/Tesseract-OCR/tesseract.exe"

# Change the directory to the location where image is present
os.chdir(r"../../assets/img")

# Load the Image
img = Image.open('Sem Título.png')

# Convert Image to Text
text = pytesseract.image_to_string(img)
print(text)

# To save Text using pywhatkit
kit.text_to_handwriting(text, "handwriting.png", (18, 10, 143))