forked from sujoyroyskr/Introduction-To-Tkinter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTkinter6.py
24 lines (16 loc) · 807 Bytes
/
Tkinter6.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from tkinter import *
## Start Using classes
class TkinterButton: ##Class Created
def __init__(self, master): ## Root is now Master and further it's called by the frame
frame = Frame(master)
frame.pack()
## Creating Buttons inside the frame
self.printButton = Button(frame, text="Message Printed", command=self.printMessage) ## self.printMessage is another function for printing out the Message
self.printButton.pack()
self.quitButton = Button(frame, text="Quit Task", command=frame.quit) ## frame.quit makes you exit from the window
self.quitButton.pack()
def printMessage(self):
print("This Is GUI with Tkinter")
root = Tk()
class_call = TkinterButton(root) ## An object to call the class
root.mainloop()