-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_Tkinter_1.py
More file actions
32 lines (27 loc) · 960 Bytes
/
Copy pathPython_Tkinter_1.py
File metadata and controls
32 lines (27 loc) · 960 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
#!/bin/env python2
# -*- coding: utf-8 -*-
from Tkinter import *
import tkMessageBox
class Application(Frame):
def __init__(self, master=None):
#Frame.__init__(self, master)
Frame.__init__(self, width=800, height=100, padx=100, pady=60, bd=4, relief=RIDGE, background="violet")
print "__init__"
self.pack()
#self.pack(fill=BOTH, padx=100, pady=60)
self.pack(expand=TRUE, fill=BOTH, side=BOTTOM)
self.createWidgets()
def createWidgets(self):
print "createWidgets"
self.nameInput = Entry(self)
self.nameInput.pack()
self.alertButton = Button(self, text='Hello', command=self.hello)
self.alertButton.pack()
def hello(self):
name = self.nameInput.get() or 'world'
print "Hello World"
tkMessageBox.showinfo('Message', 'Hello, %s' % name)
print "A Tkinter APP"
app = Application()
app.master.title('Hello World')
app.mainloop()