SendKey into Notepad by python

 SendKey into Notepad by Python Program

  1. First open terminal 



Python Terminal



2. Now Write that below code on terminal and press enter 
python -m pip install pywin32
Install Pywin32


3.Write below code

: CODE :


from tkinter import*
import win32com.client as comctl
window = Tk()
window.title(
"Button Clicked")
window.geometry(
'350x200')

wsh = comctl.Dispatch(
"WScript.Shell")

def clicked():
wsh.AppActivate(
"Notepad")
wsh.SendKeys(
"a")
btn = Button(window,
text="a", command = clicked)
btn.grid(
column = 1, row = 0
)


window.mainloop()


4.First Open Notepad and after than run that python program

OUTPUT

Python program with notepad



Comments