This is what you are looking for
from PyQt4 import QtGui, QtCore from PyQt4.QtCore import pyqtSignal import os,sys class Main(QtGui.QWidget): def __init__(self, parent=None): super(Main, self).__init__(parent) layout = QtGui.QVBoxLayout(self)
In your code, you had a button in a button, and a nested button was not assigned to a QLayout widget. Although, I'm not sure why you are adding a button inside a button. One thing that I learned from working with the GUI is that it is much easier if you modulate your code. Now you can use this custom button and apply it elsewhere.
source share