-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
autoTyperGUI.py
executable file
·162 lines (121 loc) · 4.68 KB
/
autoTyperGUI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/bin/python3
import tkinter as tk
import tkinter.scrolledtext as scrolledtext
from tkinter import messagebox
import webbrowser
import time
import multiprocessing
import sys
def typing(delay, interval, data):
delay = int(delay)
time.sleep(delay)
import pyautogui
pyautogui.FAILSAFE = False
pyautogui.write(data, interval=interval)
def start_typing():
global t1
t1 = multiprocessing.Process(target=typing, args=(ent_delay.get(), ent_interval.get(), txt_box.get("1.0", tk.END)[:-1]))
t1.start()
messagebox.showinfo("Message", "Click on the Window where you want text to be typed.")
def stop_typing():
t1.terminate()
t1.join()
sys.stdout.flush()
global i
def exit_program():
sys.exit()
def select_all(event):
txt_box.tag_add(tk.SEL, "1.0", tk.END)
txt_box.mark_set(tk.INSERT, "1.0")
txt_box.see(tk.INSERT)
return 'break'
def callback(url):
webbrowser.open_new(url)
def create_about_window():
about_window = tk.Toplevel(window)
about_window.title("About")
lbl_name = tk.Label(text="Version - Auto Typer 1.0", master=about_window, font='Helvetica 15')
lbl_name.grid(row=0, column=0, pady=(15,5), padx=10)
lbl_developer = tk.Label(text="Developer - Parvesh Monu", master=about_window, font='Helvetica 10')
lbl_developer.grid(row=1, column=0, pady=5, padx=10)
lbl_twitter = tk.Label(text="Follow - https://twitter.com/parveshmonu", master=about_window, font='Helvetica 10', fg="blue", cursor="hand2")
lbl_twitter.grid(row=2, column=0, pady=5, padx=10)
lbl_twitter.bind("<Button-1>", lambda e: callback("https://twitter.com/parveshmonu"))
lbl_github = tk.Label(text="Github - https://github.com/Parveshdhull", master=about_window, font='Helvetica 10', fg="blue", cursor="hand2")
lbl_github.grid(row=3, column=0, pady=5, padx=10,)
lbl_github.bind("<Button-1>", lambda e: callback("https://github.com/Parveshdhull"))
lbl_youtube= tk.Label(text="YouTube - https://youtube.com/right2trick", master=about_window, font='Helvetica 10', fg="blue", cursor="hand2")
lbl_youtube.grid(row=4, column=0, pady=10, padx=10,)
lbl_youtube.bind("<Button-1>", lambda e: callback("https://youtube.com/right2trick"))
buy_coffee = tk.Button(text="Buy me a coffee", master=about_window)
buy_coffee.grid(row=5,column=0, padx=10, pady=(10,20))
buy_coffee.bind("<Button-1>", lambda e: callback("https://www.buymeacoffee.com/parveshmonu"))
about_window.mainloop()
def configure_weight():
# frm_params
frm_params.columnconfigure(0, weight=1)
frm_params.columnconfigure(1, weight=1)
frm_params.rowconfigure(0, weight=1)
frm_params.rowconfigure(1, weight=1)
# frm_buttons
frm_buttons.columnconfigure(0, weight=1)
frm_buttons.columnconfigure(1, weight=1)
frm_buttons.columnconfigure(2, weight=1)
frm_buttons.rowconfigure(0, weight=1)
# main window
window.columnconfigure(0, weight=1)
window.rowconfigure(0, weight=1)
window.rowconfigure(1, weight=1)
window.rowconfigure(2, weight=1)
window.rowconfigure(3, weight=1)
window.rowconfigure(4, weight=1)
def create_main_window():
window.title("Auto Typer")
# Params Frame
global frm_params
frm_params = tk.Frame()
frm_params.grid(row=0,column=0)
# Delay
lbl_delay = tk.Label(text="Inital Delay (In Sec)", master=frm_params)
lbl_delay.grid(row=0,column=0, padx=50, pady=5)
global ent_delay
ent_delay = tk.Entry(justify='center', master=frm_params)
ent_delay.insert(0, "10")
ent_delay.grid(row=1,column=0, padx=50)
# Interval
lbl_interval = tk.Label(text="Interval (In Sec)", master=frm_params)
lbl_interval.grid(row=0,column=1, padx=50, pady=5)
global ent_interval
ent_interval = tk.Entry(justify='center', master=frm_params)
ent_interval.insert(0, "0.07")
ent_interval.grid(row=1,column=1, padx=50)
# Data
lbl_data = tk.Label(text="Paste Text Here", font='Helvetica 18 bold' )
lbl_data.grid(row=3,column=0, pady=(10,2))
global txt_box
txt_box = scrolledtext.ScrolledText(window, undo=True)
txt_box.grid(row=4,column=0)
txt_box.bind("<Control-Key-a>", select_all)
txt_box.bind("<Control-Key-A>", select_all)
# Buttons Frame
global frm_buttons
frm_buttons = tk.Frame()
frm_buttons.grid(row=5,column=0)
# Start
start = tk.Button(text="Start", master=frm_buttons, command=start_typing)
start.grid(row=0,column=0, padx=10, pady=10)
# Stop
start = tk.Button(text="Stop", master=frm_buttons, command=stop_typing)
start.grid(row=0,column=1, padx=10, pady=10)
# Exit
start = tk.Button(text="Exit", master=frm_buttons, command=exit_program)
start.grid(row=0,column=2, padx=10, pady=10)
# About
start = tk.Button(text="About", command=create_about_window)
start.grid(row=6,column=0, padx=10, pady=10)
configure_weight()
window.mainloop()
if __name__ == '__main__':
multiprocessing.freeze_support()
window = tk.Tk()
create_main_window()