forked from MorvanZhou/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtk3_entry_text.py
More file actions
32 lines (26 loc) · 789 Bytes
/
tk3_entry_text.py
File metadata and controls
32 lines (26 loc) · 789 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
# View more python learning tutorial on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
import tkinter as tk
window = tk.Tk()
window.title('my window')
window.geometry('200x200')
# e = tk.Entry(window, show="*")
e = tk.Entry(window, show="1")
e.pack()
def insert_point():
var = e.get()
t.insert('insert', var)
def insert_end():
var = e.get()
# t.insert('end', var)
t.insert(2.2, var)
b1 = tk.Button(window, text='insert point', width=15,
height=2, command=insert_point)
b1.pack()
b2 = tk.Button(window, text='insert end',
command=insert_end)
b2.pack()
t = tk.Text(window, height=2)
t.pack()
window.mainloop()