Pygubu is the best option for python drag and drop gui insted you can also use pyQt5 also they will work good for it
Here is what the above code is Doing:
1. We start by importing the required modules.
2. We create a class called MainWindow and inherit from the tkinter.Tk class.
3. We create a constructor for the class and pass in the parent window as an argument.
4. We create a label and pack it into the window.
5. We create a button and pack it into the window.
6. We bind the button to the on_button_click method.
7. We define the on_button_click method.
8. We create an instance of the MainWindow class.
9. We start the mainloop of the window.