SHARE
TWEET

Untitled

a guest Jun 20th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def __init__(self, texts, parent):
  2. QWidget.__init__(self, parent)
  3.  
  4. self.signalMapper = QSignalMapper(self)
  5.  
  6. layout = QGridLayout()
  7.  
  8. for text, index in enumerate(texts):
  9.     button = QPushButton(text)
  10.     self.connect(SIGNAL("clicked()"), self.signalMapper, SLOT("map()"))
  11.     self.signalMapper.setMapping(button, text)
  12.     layout.addWidget(button, index / 3, index % 3)
  13.  
  14. self.signalMapper.connect(SIGNAL("mapped(const QString &)"),
  15.         self, SLOT("clicked(const QString &)"))
  16.  
  17. self.setLayout(layout)
  18.      
  19. self.line1 = QLineEdit()
  20.     self.line1.setFixedWidth(250)
  21.     self.line1.setStyleSheet('color: blue;'
  22.                              'font-size: 21px;'
  23.                              'font-family: Purisa;'
  24.                              'font-weight: bold')
  25.     self.line1.returnPressed.connect(self.soup)
  26.     self.signalMapper = QSignalMapper(self)
  27.     #When next line runs, "SIGNAL" is not recognized.
  28.     self.connect(SIGNAL("clicked()"), self.signalMapper,SLOT("map()"))
  29.     self.signalMapper.setMapping(self.line1, self.line1.clear())
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top