1
+ '''
2
+ Created on Aug 12, 2017
3
+
4
+ @author: Aditya
5
+ '''
6
+
7
+ import tkinter as tk
8
+ from tkinter import ttk
9
+
10
+ class Helloapp :
11
+ def __init__ (self , master ):
12
+ # display label in main window master
13
+ self .label = ttk .Label (master , text = 'Hello, World and This is Python3.6 speaking' )
14
+
15
+ # place the label using grid method in the main window
16
+ self .label .grid (row = 0 , column = 0 , columnspan = 2 )
17
+
18
+ # Create and place button below label
19
+ ttk .Button (master , text = 'Delhi' , command = self .delhi_hello ).grid (row = 1 , column = 0 )
20
+ ttk .Button (master , text = 'Pune' , command = self .pune_hello ).grid (row = 1 , column = 1 )
21
+
22
+ def delhi_hello (self ):
23
+ self .label .config (text = 'Namaste Duniya, main Python hu.' )
24
+
25
+ def pune_hello (self ):
26
+ self .label .config (text = 'Bhava, hey Python3.6 ahe.' )
27
+
28
+
29
+
30
+ def HelloAppLaunch ():
31
+ root = tk .Tk ()
32
+ Helloapp (root )
33
+ root .mainloop ()
34
+
35
+ def test ():
36
+ HelloAppLaunch ()
37
+
38
+ if __name__ == '__main__' :test ()
0 commit comments