예제26 파이썬 음성 인식 -> 테스트 변환 -> ChatGPT -> 텍스트 음성 변환 -> 음성 출력 코드 speech recognition, pyttsx, openai, microphone, tts, stt import speech_recognition as srimport pyttsx3import openaiopenai.api_key = "openai key"# Initialize the recognizerr = sr.Recognizer()# Initialize the voice enginevoice_engine = pyttsx3.init()#스피치 목소리 타입 0: K, 1: female, 2: malevoices = voice_engine.getProperty('voices') voice_engine.setProperty('voice', voices[0].id)voice_engine.setProperty('rate', 170) # Function to convert text to speechdef S.. 2023. 9. 2. 파이썬 tkinter canvas GUI 메뉴 만들기 코드 tkinter 를 이용하여 메뉴 만들기 코드 입니다.아래 이미지파일을 다운로드받고 소스코드와 같은 폴더에서 복사하여 주세요from tkinter import *class Menu: def __init__(self): window = Tk() window.title("키보드 이벤트") window.geometry("640x480") self.menu_idx = 0 self.canvas=Canvas(window, bg ="white") self.canvas.pack(expand=True, fill=BOTH) window.bind("",self.keyPressHandler) window.bind("",se.. 2022. 4. 4. 이전 1 2 3 4 5 다음