renix1

nircmd with python 3.x

Jan 7th, 2017
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. import subprocess
  2. import tkinter
  3.  
  4. class JanelaPrincipal(tkinter.Tk):
  5.     def __init__(self):
  6.         tkinter.Tk.__init__(self)
  7.         self.title("Fala autônoma")
  8.         self.minsize(370, 150)
  9.         self.resizable(False, False)
  10.         frame_x = tkinter.Frame()
  11.         frame_z = tkinter.Frame()
  12.         frame_x.grid(row=0, column=0)
  13.         frame_z.grid(row=0, column=1)
  14.         tkinter.Label(frame_x, text="O que você deseja que eu fale? Insira aí embaixo!", font=('Arial', 10, 'bold'))\
  15.             .grid(row=1, column=0)
  16.         self.texto = tkinter.Text(frame_x, height=7, width=int(370//8.3), relief='groove')
  17.         self.texto.grid(row=2, column=0, padx=2)
  18.         bt = tkinter.Button(frame_z, text="Falar", command=self.fala).grid(row=0, column=1, padx=5)
  19.         self.mainloop()
  20.  
  21.     def fala(self):
  22.         subprocess.call("nircmd speak text \"%s\"" % self.texto.get(1., tkinter.END))
  23.  
  24. JanelaPrincipal()
Advertisement
Add Comment
Please, Sign In to add comment