forked from ankitjain28may/pythonResources
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtk.py
More file actions
30 lines (25 loc) · 1.04 KB
/
tk.py
File metadata and controls
30 lines (25 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
from Tkinter import *
class App:
def __init__(self, master):
frame = Frame(root, width=450, height=250)
frame.pack()
self.quote = Label(frame, text="hel", height=10, width=30, wraplength=300,
bg="#fff", padx=10, fg="#333", font=("Helvetica", 14))
self.quote.pack()
self.author = Label(frame, text="-" + "author", anchor="e",
justify='right', padx=20, pady=15, bg="#fff", fg="#444", font=("Helvetica", 12))
self.author.pack(side="right")
self.button = Button(frame, text="QUIT", fg="red", justify="left")
self.button.bind("<Button-1>", self.callback)
self.button.pack()
self.hi_there = Button(frame, text="Hello",
command=self.say_hi, justify="left")
self.hi_there.pack()
def say_hi(self):
print "hi there, everyone!"
def callback(self, event):
print "clicked at", event.x, event.y
root = Tk()
root.configure(background='#fff')
app = App(root)
root.mainloop()