"""
Code illustration: 1.11
A demonstration of tkinter Variable Class
IntVar, StringVar & BooleanVar

@Tkinter GUI Application Development Blueprints
""" 
from tkinter import *
root = Tk()

def show():
    print( "You entered:")
    print( "Employee Number: "+ str(employee_number.get()))
    print( "Login Password: "+ password.get())
    print( "Remember Me: "+ str(remember_me.get()))
    print( '*'*30)

#demo of IntVar
Label(root, text="Employee Number:").grid(row=1, column=1)
employee_number = IntVar()
Entry(root, width=40, textvariable=employee_number).grid(row=1, column=2, columnspan=2)
employee_number.set("120350")


#demo of StringVar
Label(root, text="Login Password:").grid(row=2, column=1, sticky='w')
password = StringVar() # defines the widget state as string
Entry(root,width=40, show="*",  textvariable=password).grid(row=2, column=2, columnspan=2) 
password.set("mysecretpassword")

Button(root,text="Login", command=show).grid(row=3, column=3)

#demo of Boolean var
remember_me = BooleanVar()
Checkbutton(root, text="Remember Me", variable=remember_me).grid(row=3, column=2)
remember_me.set(True)



root.mainloop()

6f919800f9bb4a5f550091b084fe95e97d5c31e8
<mask token>


def show():
    print('You entered:')
    print('Employee Number: ' + str(employee_number.get()))
    print('Login Password: ' + password.get())
    print('Remember Me: ' + str(remember_me.get()))
    print('*' * 30)


<mask token>

<mask token>


def show():
    print('You entered:')
    print('Employee Number: ' + str(employee_number.get()))
    print('Login Password: ' + password.get())
    print('Remember Me: ' + str(remember_me.get()))
    print('*' * 30)


Label(root, text='Employee Number:').grid(row=1, column=1)
<mask token>
Entry(root, width=40, textvariable=employee_number).grid(row=1, column=2,
    columnspan=2)
employee_number.set('120350')
Label(root, text='Login Password:').grid(row=2, column=1, sticky='w')
<mask token>
Entry(root, width=40, show='*', textvariable=password).grid(row=2, column=2,
    columnspan=2)
password.set('mysecretpassword')
Button(root, text='Login', command=show).grid(row=3, column=3)
<mask token>
Checkbutton(root, text='Remember Me', variable=remember_me).grid(row=3,
    column=2)
remember_me.set(True)
root.mainloop()

<mask token>
root = Tk()


def show():
    print('You entered:')
    print('Employee Number: ' + str(employee_number.get()))
    print('Login Password: ' + password.get())
    print('Remember Me: ' + str(remember_me.get()))
    print('*' * 30)


Label(root, text='Employee Number:').grid(row=1, column=1)
employee_number = IntVar()
Entry(root, width=40, textvariable=employee_number).grid(row=1, column=2,
    columnspan=2)
employee_number.set('120350')
Label(root, text='Login Password:').grid(row=2, column=1, sticky='w')
password = StringVar()
Entry(root, width=40, show='*', textvariable=password).grid(row=2, column=2,
    columnspan=2)
password.set('mysecretpassword')
Button(root, text='Login', command=show).grid(row=3, column=3)
remember_me = BooleanVar()
Checkbutton(root, text='Remember Me', variable=remember_me).grid(row=3,
    column=2)
remember_me.set(True)
root.mainloop()

<mask token>
from tkinter import *
root = Tk()


def show():
    print('You entered:')
    print('Employee Number: ' + str(employee_number.get()))
    print('Login Password: ' + password.get())
    print('Remember Me: ' + str(remember_me.get()))
    print('*' * 30)


Label(root, text='Employee Number:').grid(row=1, column=1)
employee_number = IntVar()
Entry(root, width=40, textvariable=employee_number).grid(row=1, column=2,
    columnspan=2)
employee_number.set('120350')
Label(root, text='Login Password:').grid(row=2, column=1, sticky='w')
password = StringVar()
Entry(root, width=40, show='*', textvariable=password).grid(row=2, column=2,
    columnspan=2)
password.set('mysecretpassword')
Button(root, text='Login', command=show).grid(row=3, column=3)
remember_me = BooleanVar()
Checkbutton(root, text='Remember Me', variable=remember_me).grid(row=3,
    column=2)
remember_me.set(True)
root.mainloop()

"""
Code illustration: 1.11
A demonstration of tkinter Variable Class
IntVar, StringVar & BooleanVar

@Tkinter GUI Application Development Blueprints
""" 
from tkinter import *
root = Tk()

def show():
    print( "You entered:")
    print( "Employee Number: "+ str(employee_number.get()))
    print( "Login Password: "+ password.get())
    print( "Remember Me: "+ str(remember_me.get()))
    print( '*'*30)

#demo of IntVar
Label(root, text="Employee Number:").grid(row=1, column=1)
employee_number = IntVar()
Entry(root, width=40, textvariable=employee_number).grid(row=1, column=2, columnspan=2)
employee_number.set("120350")


#demo of StringVar
Label(root, text="Login Password:").grid(row=2, column=1, sticky='w')
password = StringVar() # defines the widget state as string
Entry(root,width=40, show="*",  textvariable=password).grid(row=2, column=2, columnspan=2) 
password.set("mysecretpassword")

Button(root,text="Login", command=show).grid(row=3, column=3)

#demo of Boolean var
remember_me = BooleanVar()
Checkbutton(root, text="Remember Me", variable=remember_me).grid(row=3, column=2)
remember_me.set(True)



root.mainloop()
