from tkinter import *


class AWindowDemo:

    
        
    def __init__(self, rootWin):
        l = Label(rootWin, text="This is a label")
        l.pack()
        
        f = Frame(rootWin, borderwidth=15, relief="raised")
        f.pack(side=RIGHT)
        b2 = Button(f, text="GetText", command= self.callback1 )
        b2.pack(side=LEFT, fill=X)
        
        b = Button(f, text="SetText!", command=self.callback2)
        b.pack(side=LEFT)


        self.myString = StringVar()
        
        e = Entry(rootWin, textvariable=self.myString)
        e.pack(side=LEFT)

        e2 = Entry(f, textvariable=self.myString)
        e2.pack(side=BOTTOM)
        
    def callback2(self):
        self.myString.set("Boo!")

    def callback1(self):
        myStr = self.myString.get()
        print("my str is:", myStr)
        myNum = float(myStr)
        print("num * 5", myNum * 5)





rootWin = Tk()
app = AWindowDemo(rootWin)
rootWin.mainloop()
