-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgui_basic.py
More file actions
36 lines (26 loc) · 1.04 KB
/
Copy pathgui_basic.py
File metadata and controls
36 lines (26 loc) · 1.04 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
import Tkinter
class simpleapp_tk(Tkinter.Tk):
def __init__(self,parent):
Tkinter.Tk.__init__(self,parent)
self.parent = parent
self.initialize()
def initialize(self):
self.grid()
self.entry = Tkinter.Entry(self)
self.entry.grid(column=0,row=0,sticky='EW')
self.entry.bind('<Return>',self.OnPressEnter)
button = Tkinter.Button(self,text=u'Click me !',command=self.OnButtonClick)
button.grid(column=1,row=0)
self.labelVariable = Tkinter.StringVar()
label = Tkinter.Label(self,textvariable=self.labelVariable,anchor='w',fg='white',bg='blue')
label.grid(column=0,row=1,columnspan=2,sticky='EW')
self.grid_columnconfigure(0,weight=1)
self.resizable(True,False)
def OnButtonClick(self):
self.labelVariable.set('You clicked the button !')
def OnPressEnter(self,event):
self.labelVariable.set('You pressed enter !')
if __name__ == '__main__':
app = simpleapp_tk(None)
app.title('my application')
app.mainloop()