title: Creating a pop-up window from custom pushbutton python
body: <p>I am trying to create a pop-up window that gets popped-up from pressing on a QPushButton. However, I have a separate QPushButton class that I would like to use. I can't seem to get it working. Anything I am doing wrong?</p>
  
  <pre><code>#import ... statements
  import sys
  
  # from ... import ... statements
  from PyQt5.QtWidgets import (QMainWindow, QApplication, QPushButton, QGridLayout, QWidget, QHBoxLayout, QLabel,
                               QVBoxLayout)
  from PyQt5.QtCore import Qt
  from PyQt5.QtGui import QFont, QFontDatabase, QColor, QPalette, QMovie
  from skimage import transform, io
  
  # Create main window of the widget
  class MainWindow(QWidget):
      def __init__(self):
          super().__init__()
          #Set a title inside the widget
          self.titleLabel = QLabel()
          titleText = "some title text"
          self.titleLabel.setText(titleText)
  
          # Give the label some flair
          self.titleLabel.setFixedWidth(1000)
          self.titleLabel.setAlignment(Qt.AlignCenter)
  
          QFontDatabase.addApplicationFont(link_to_custom_font)
          font = QFont()
          font.setFamily("custom_font_name")
          font.setPixelSize(50)
          self.titleLabel.setFont(font)
  
  
          # Set first button - The "Yes" Button
          self.btn1 = myButtonOne("Yes")
  
          #Initialize GUI
          self.layoutGUI()
          self.initUI()
  
      def initUI(self):
          self.fromleft = 200
          self.fromtop = 100
          self.w = 1000
          self.h = 500
  
          self.setGeometry(self.fromleft, self.fromtop, self.w, self.h)
  
      def layoutGUI(self):
          hbox = QHBoxLayout()
          hbox.setSpacing(20)
  
          hbox.addWidget(self.btn1)
  
          vbox = QVBoxLayout()
          vbox.addWidget(self.titleLabel)
          vbox.addLayout(hbox)
  
          self.setLayout(vbox)
  
  class myButtonOne(QPushButton):
      def __init__(self, parent=None):
          super(myButtonOne, self).__init__(parent)
  
          # Set maximum border size
          imSize = io.imread(imagePath)
          imHeight = imSize.shape[1]
          imWidth = imSize.shape[0]
  
          # Set first button - The "Yes" Button
          yesImage = someImagePath
          self.setStyleSheet("background-image: url(" + yesImage + ");"
                             "background-repeat: none;"
                             "background-position: center;"
                                                                   "border: none")
          self.setFixedSize(imWidth, imHeight)
  
          self.clicked.connect(self.buttonOnePushed)
  
      def buttonOnePushed(self):
          textView().show()
  
      def enterEvent(self, event):
          newImage = someOtherImagePath
          self.setStyleSheet("background-image: url("+newImage+");"
                             "background-repeat: none;"
                             "background-position: center;"
                                                                   "border: none")
  
      def leaveEvent(self, event):
          newImage = someImagePath
          self.setStyleSheet("background-image: url("+newImage+");"
                             "background-repeat: none;"
                             "background-position: center;"
                                                                   "border: none")
  
  class textView(QWidget):
      def __init(self):
          textView.__init__()
  
          theText = QLabel()
          #define sizes
          self.height = 550
          self.width = 250
  
          # Open QWidget
          self.initUI()
  
          # Set the text for the QLabel
          someText = "Some Text for the label"
          theText.setText(someText)
  
  
      def initUI(self):
          self.show()
  
  # Start GUI
  if __name__ == '__main__':
      app = QApplication(sys.argv)
      win = MainWindow()
      win.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>So, I am trying to keep the QPushButton classes separate, so that I can customize them. I would like to keep it like that, especially to keep it clean and readable.</p>