-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinput_box.py
More file actions
46 lines (35 loc) · 1.13 KB
/
input_box.py
File metadata and controls
46 lines (35 loc) · 1.13 KB
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
from tkinter import *
def submit():
entryValue = entry.get()
print("Hello " + entryValue)
def delete():
entry.delete(0, END)
def backSpace():
current_text = entry.get()
if current_text:
entry.delete(len(current_text) - 1, END)
window = Tk()
window.title("Input Box Program Tkinter")
window.geometry("300x200")
window.config(bg="gray")
entry = Entry(window,
font=("Audiowide", 40, "bold"),
fg="green",
bg="black",)
# entry.insert(0, "Enter Your Name") to add default text
# entry.config(state=DISABLED) to disable input
# entry.config(show="*") to hide input
entry.pack(side=LEFT)
submit_button = Button(window,
text="Submit",
command=submit)
submit_button.pack(side=RIGHT)
delete_button = Button(window,
text="Delete",
command=delete)
delete_button.pack(side=RIGHT)
backSpace_button = Button(window,
text="BackSpace",
command= backSpace)
backSpace_button.pack(side=RIGHT)
window.mainloop()