declare your functions before you create the buttons unless you create a class
python reads your script from top to bottom:
python reads your script from top to bottom:
def add_medication1(): keyboard() def confirm1(): global morn_med_label,confirm_button1 morn_med=morn_med_Text.get("1.0",END) morn_med_label.place(relx=0.179, rely =0.82, anchor = CENTER) morn_med_Text.place_forget() confirm_button1.place_forget() morn_med_button.place(relx=0.2, rely = 0.76, anchor = CENTER) morn_med_label.config(text=morn_med) confirm_button1.bind("<Button-1>",keyboard) morn_med_Text=Text(root,width=20,height=13) morn_med_Text.place(x=300,y=300) morn_med_label=Label(root,bg="light blue", font=("Arial",15 )) morn_med_button = Button(root, text="Add Medication", command=add_medication1, font=("Arial", 12)) morn_med_button.place(relx=0.2, rely = 0.76, anchor = CENTER) confirm_button1=Button(root, text="Confirm", command=confirm1, font=("Arial", 12)) confirm_button1.place(x=5,y=400)if you bind a mouse event to a function it requires an argument
def keyboard(event): morn_med_button.unbind("<Button-1>") def select(value): ....# moreI used event but it could be anything you want- then you can get information from the event like x= event.x to give you the x,y position of the mouse click