Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # clear a certain part or multipart with a mouse click
- # for this we will use a frame
- # we will create a event listener and bind it to the root
- # anything you want to vanish from interface put inside the frame
- # the moment you click the mouse left button on the interface
- # everything visible will be vanish
- # ayanu881@gmail.com
- from tkinter import *
- root = Tk()
- root.title('Experiment')
- root.geometry('400x400')
- my_frame = Frame(root)
- my_label = Label(my_frame, text="This is a text", font=('Helvetica 24 bold'))
- my_label.pack(pady=20)
- def clear_everything(event):
- my_frame.pack_forget()
- my_frame.pack()
- # event binding to the root
- root.bind('<Button-1>',clear_everything)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement