forked from electrocoder/python-kod-bankasi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbutton_focus.py
33 lines (24 loc) · 911 Bytes
/
button_focus.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
from Tkinter import *
class MyApp:
def __init__(self, parent):
self.myParent = parent
self.myContainer1 = Frame(parent)
self.myContainer1.pack()
button_name = "OK"
self.button1 = Button(self.myContainer1,
command=self.buttonHandler(button_name, 1, "Good stuff!"))
self.button1.configure(text=button_name)
self.button1.pack(side=LEFT)
self.button1.focus_force() # Put keyboard focus on button1
button_name = "Cancel"
self.button2 = Button(self.myContainer1,
command=self.buttonHandler(button_name, 2, "Bad stuff!"))
self.button2.configure(text=button_name)
self.button2.pack(side=LEFT)
def buttonHandler(self, arg1, arg2, arg3):
print ""
def buttonHandler_a(self, event, arg1, arg2, arg3):
print ""
root = Tk()
myapp = MyApp(root)
root.mainloop()