'How to make a button that when pressed will pop up an object on the window associated with a class?

I'm really new to PyQt5. I searched in tutorials but I haven't come across one to teach me how to do this. My idea is to have a button in the window so that whenever I press, there will be a square popping up on the window and I can move it around. This new square will be associated with a class and I can input information to the class from this square. Any help would be really appreciated. Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source