-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGUI_Tkinter.py
More file actions
30 lines (24 loc) · 810 Bytes
/
GUI_Tkinter.py
File metadata and controls
30 lines (24 loc) · 810 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
#!/user/bin/env python3
# coding:utf-8
'a GUI program by Tkinter'
__author__ = 'zmxqq'
from tkinter import *
import tkinter.messagebox as messagetbox
class Application(Frame):
def __init__(self, master = None):
Frame.__init__(self, master)
self.pack()
self.createWidgets()
def createWidgets(self):
self.nameIput = Entry(self)
self.nameIput.pack()
self.helloButton = Button(self, text='Hello,world!', command=self.hello)
self.helloButton.pack()
self.quitButton = Button(self, text='Quit', command=self.quit)
self.quitButton.pack()
def hello(self):
name = self.nameIput.get() or 'world'
messagetbox.showinfo('Message', 'hello, %s' % name)
app = Application()
app.master.title("Hello,world!")
app.mainloop()