import tkinter
"""
root = tkinter.Tk()
root.geometry("500x500")
frame = tkinter.Frame(root, padx =500, pady =300)
frame.pack()
bt=tkinter.Button(root, text='click')
bt.place(x=3,y=3,width=100, height=100)
bt.grid()
def change_bg():
btn.configure(background='green')
frame_up.configure(background='yellow')
root=tkinter.Tk()
root.geometry("{}x{}".format(100,100))
frame_up=tkinter.Frame(root,height=60,width=90,background='blue')
frame_down=tkinter.Frame(root,height=30, width=90)
frame_up.pack()
frame_down.pack()
btn=tkinter.Button(frame_down, text='click',command=change_bg, foreground='white', background='black',activeforeground='blue', activebackground='#FF007F')
btn.pack()
root.mainloop()
def increase():
number.set(number.get()+1)
def decrease():
number.set(number.get()-1)
root=tkinter.Tk()
frame=tkinter.Frame(root)
frame.pack()
number=tkinter.IntVar(value=0)
button=tkinter.Button(frame, text='increase', command=increase)
button.pack()
button=tkinter.Button(frame, text='decrease', command=decrease)
button.pack()
label=tkinter.Label(frame, text='start', textvariable=number)
label.pack()
root.mainloop()
def reset():
text_id.set('')
text_pw.set('')
text_z.set('')
"""
"""
def f():
a = int(text_id.get())
b = int(text_pw.get())
a=a+b
text_z.set(a)
root=tkinter.Tk()
root.title("login")
root.geometry('200x100')
text_id=tkinter.StringVar(value='')
text_pw=tkinter.StringVar(value='')
text_z=tkinter.StringVar(value='')
frame=tkinter.Frame(root)
frame.pack()
button=tkinter.Button(frame, text='reset',command=f)
button.grid(row=0,column=0, columnspan=2)
label=tkinter.Label(frame, text='ID')
label.grid(row=1,column=0)
entry_id=tkinter.Entry(frame, textvariable=text_id)
entry_id.grid(row=1,column=1)
label=tkinter.Label(frame, text='PW')
label.grid(row=2,column=0)
entry_pw=tkinter.Entry(frame, textvariable=text_pw)
entry_pw.grid(row=2,column=1)
label=tkinter.Label(frame, text='z')
label.grid(row=3,column=0)
entry_z=tkinter.Entry(frame, textvariable=text_z)
entry_z.grid(row=3,column=1)
root.mainloop()
def f0():
n = text_pw.get()+'0'
text_pw.set(n)
def f1():
n = text_pw.get()+'1'
text_pw.set(n)
def f2():
n = text_pw.get()+'2'
text_pw.set(n)
def f3():
n = text_pw.get()+'3'
text_pw.set(n)
def f4():
n = text_pw.get()+'4'
text_pw.set(n)
def f5():
n = text_pw.get()+'5'
text_pw.set(n)
def f6():
n = text_pw.get()+'6'
text_pw.set(n)
def f7():
n = text_pw.get()+'7'
text_pw.set(n)
def f8():
n = text_pw.get()+'8'
text_pw.set(n)
def f9():
n = text_pw.get()+'9'
text_pw.set(n)
def f11():
n = text_pw.get()+'+'
text_pw.set(n)
def f22():
n = text_pw.get()+'-'
text_pw.set(n)
def f33():
n = text_pw.get()+'/'
text_pw.set(n)
def f44():
n = text_pw.get()+'*'
text_pw.set(n)
def f55():
n = text_pw.get()+'='
text_pw.set(n)
root=tkinter.Tk()
root.title("cal")
root.geometry('500x500')
frame=tkinter.Frame(root)
frame.pack()
text_pw=tkinter.StringVar(value='')
entry_pw=tkinter.Entry(frame, textvariable=text_pw)
entry_pw.grid(row=0,column=1)
button=tkinter.Button(frame, text='+',command=f11)
button.grid(row=1,column=0)
button=tkinter.Button(frame, text='-',command=f22)
button.grid(row=1,column=1)
button=tkinter.Button(frame, text='/',command=f33)
button.grid(row=1,column=2)
button=tkinter.Button(frame, text='*',command=f44)
button.grid(row=1,column=3)
button=tkinter.Button(frame, text='7',command=f7)
button.grid(row=2,column=0)
button=tkinter.Button(frame, text='8',command=f8)
button.grid(row=2,column=1)
button=tkinter.Button(frame, text='9',command=f9)
button.grid(row=2,column=2)
button=tkinter.Button(frame, text='4',command=f4)
button.grid(row=3,column=0)
button=tkinter.Button(frame, text='5',command=f5)
button.grid(row=3,column=1)
button=tkinter.Button(frame, text='6',command=f6)
button.grid(row=3,column=2)
button=tkinter.Button(frame, text='1',command=f1)
button.grid(row=4,column=0)
button=tkinter.Button(frame, text='2',command=f2)
button.grid(row=4,column=1)
button=tkinter.Button(frame, text='3',command=f3)
button.grid(row=4,column=2)
button=tkinter.Button(frame, text='0',command=f0)
button.grid(row=5,column=1)
button=tkinter.Button(frame, text='=',command=f55)
button.grid(row=5,column=2)
"""
def callback():
root.title("Hello Python")
root=tkinter.Tk()
frame = tkinter.Frame(root, padx =100, pady =50)
frame.pack()
button=tkinter.Button(frame, text='click')
button.pack()
label=tkinter.Label(frame, text='click2')
label.pack()
button.bind("<ButtonPress-1>",lambda e: callback() )
button.bind("<Double-1>",lambda e: root.title("Mouse Double click"))
button.bind("<ButtonPress-3>",lambda e: root.title("Mouse Right click"))
label.bind("<Double-2>",lambda e: root.title("tkinter Label event"))
root.mainloop()