예제 #1
0
    def __init__(self, q, threadDict, speechCommandsTuple=None):
        #print(    "args: ",  args,  "kargs: ",  kargs    )
        self.q = q
        self.tq = queue.Queue()

        print('working...')

        winspeech.initialize_recognizer(winspeech.INPROC_RECOGNIZER)
        with threadDict as td:
            if speechCommandsTuple == None:
                try:
                    ## this is here as experimental support
                    ## for custom winspeech version
                    listener = winspeech.listen_joecc(None, self.onListen)
                except:
                    listener = winspeech.listen_for_anything(self.onListen)
            else:
                listener = winspeech.listen_for(speechCommandsTuple,
                                                self.onListen)

        while listener.is_listening():

            with threadDict as d:
                doFuncQuit = d['doFuncQuit']
                active = d['active']
            if doFuncQuit == True:
                listener.stop_listening()
                winspeech.stop_listening()
                break

            time.sleep(0.03)
            while not self.tq.empty():
                qv = self.tq.get()
                q.put(qv)

        print('exiting worker...')
예제 #2
0
#買うんtダウンkのう\\\\
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) Mineo Sudo
#
###############################################################################
import winspeech
import sys, datetime, time
from winsound import Beep
from tkinter import *
from tkinter import messagebox
import win32gui, win32con
import pandas as pd

winspeech.initialize_recognizer(winspeech.INPROC_RECOGNIZER)


def callback1():
    hwnd = int(root.wm_frame(), 0)
    win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 0, 0, 0, 0,
                          win32con.SWP_NOMOVE | win32con.SWP_NOSIZE)


def callback2():
    hwnd = int(root.wm_frame(), 0)
    win32gui.SetWindowPos(hwnd, win32con.HWND_NOTOPMOST, 0, 0, 0, 0,
                          win32con.SWP_NOMOVE | win32con.SWP_NOSIZE)


root = Tk()
예제 #3
0
from tkinter import *
from tkinter import ttk
import winspeech
import sys

root = Tk()
winspeech.initialize_recognizer(winspeech.INPROC_RECOGNIZER)

root.title('SpeedNotes')
label = ttk.Label
root.resizable(10,0)
lable = ttk.Label(root,text='File name:')
lable.grid(column=0,row=0)
def SpeechRecognized(result,Listener):
	print('You said: %s'%(result))
	if result == "stop":
		print('Thank you')
		winspeech.stop_listening()
		sys.exit(0)
def f():
    listener = winspeech.listen_for_anything(SpeechRecognized)
    while listener.is_listening():
        text = input()
        if (text == 'stop'):
            listener.stop_listening()
        else:
            continue
button1 = ttk.Button(root,text='speak',command=f)
button1.grid(column=1,row=0)
root.mainloop()