-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathhello.py
More file actions
30 lines (21 loc) · 746 Bytes
/
hello.py
File metadata and controls
30 lines (21 loc) · 746 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
from Tkinter import *
class App:
counter = 1
def __init__(self, master):
frame = Frame(master)
frame.pack()
for i in range(16):
self.button = Button(frame, text='QUIT', bg='black', fg='red', command=quit)
self.button.pack()
self.button2 = Button(frame, text='SLOGAN', fg='blue', command=self.write_label)
self.button2.pack(side=LEFT)
self.label = Label(root, fg='dark green')
def write_label(self):
if self.counter > 1:
self.label.destroy()
self.counter += 1
self.label = Label(text='Label number %d' % self.counter)
self.label.pack()
root = Tk()
app = App(root)
root.mainloop()