forked from BradHN1/HPAT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestentry.py
More file actions
35 lines (26 loc) · 700 Bytes
/
testentry.py
File metadata and controls
35 lines (26 loc) · 700 Bytes
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
from tkinter import *
master = Tk()
e = Entry(master)
e.pack()
e.focus_set()
def callback():
print(e.get())
b = Button(master, text="get", width=10, command=callback)
b.pack()
mainloop()
e = Entry(master, width=50)
e.pack()
text = e.get()
def makeentry(parent, caption, width=None, **options):
Label(parent, text=caption).pack(side=LEFT)
entry = Entry(parent, **options)
if width:
entry.config(width=width)
entry.pack(side=LEFT)
return entry
user = makeentry(parent, "User name:", 10)
password = makeentry(parent, "Password:", 10, show="*")
content = StringVar()
entry = Entry(parent, text=caption, textvariable=content)
text = content.get()
content.set(text)