forked from flatplanet/Intro-To-TKinter-Youtube-Course
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfocus.py
More file actions
34 lines (25 loc) · 656 Bytes
/
focus.py
File metadata and controls
34 lines (25 loc) · 656 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
from tkinter import *
root = Tk()
root.title('Codemy.com - Tab Order')
root.iconbitmap('c:/gui/codemy.ico')
root.geometry("500x550")
# Create some entry boxes
red = Entry(root, bg="red", font=("Helvetica", 20))
white = Entry(root, bg="white", font=("Helvetica", 20))
blue = Entry(root, bg="blue", font=("Helvetica", 20))
# Pack them
red.pack(pady=20)
white.pack(pady=20)
blue.pack(pady=20)
# Pick focus
white.focus()
# Change Tab order
def tab_order():
blue.focus()
widgets = [blue, white, red]
for w in widgets:
w.lift()
my_button = Button(root, text="Change Tab Order", command=tab_order)
my_button.pack(pady=20)
tab_order()
root.mainloop()