Skip to content

Commit 17db218

Browse files
authored
Create Button.py
1 parent 40d36bc commit 17db218

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Button.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from tkinter import *
2+
3+
class Window(Frame):
4+
5+
def __init__(self, master=None):
6+
Frame.__init__(self, master)
7+
self.master = master
8+
9+
# widget can take all window
10+
self.pack(fill=BOTH, expand=1)
11+
12+
# create button, link it to clickExitButton()
13+
exitButton = Button(self, text="Exit", command=self.clickExitButton)
14+
15+
# place button at (0,0)
16+
exitButton.place(x=0, y=0)
17+
18+
def clickExitButton(self):
19+
exit()
20+
21+
root = Tk()
22+
app = Window(root)
23+
root.wm_title("Tkinter button")
24+
root.geometry("320x200")
25+
root.mainloop()

0 commit comments

Comments
 (0)