-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtk_test.py
More file actions
27 lines (23 loc) · 833 Bytes
/
Copy pathtk_test.py
File metadata and controls
27 lines (23 loc) · 833 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
from Tkinter import *
import Tkinter.messagebox as messagebox
class Application(Frame):
"""docstring for Application"""
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.createWidgets()
def createWidgets(self):
self.helloLabel = Label(self, text = 'Hello, world!')
self.helloLabel.pack()
self.quitButton = Button(self, text = 'Quit', command = self.quit)
self.quitButton.pack()
self.nameInput = Entry(self)
self.nameInput.pack()
self.alb = Button(self, text = 'Hello', command = self.hello)
self.alb.pack()
def hello(self):
name = self.nameInput.get() or 'world'
messagebox.showinfo('Message', 'Hello %s' % name)
app = Application()
app.master.title('Hello World!')
app.mainloop()