[PyKDE] setText of all LineEdits with button click
Bill Burns
billburns at pennswoods.net
Sat Sep 25 16:55:58 BST 2004
On Saturday 25 September 2004 11:46 am, Bill Burns wrote:
> The original code again:
Sorry...that wasn't the original code I had first posted!! I made Michael's
changes and added a change of my own and sent the wrong one......
Here is the original code that I had first posted:
#!/usr/bin/env python
import os
import sys
from qt import *
class MyLineEdit(QLineEdit):
def __init__(self, parent):
QLineEdit.__init__(self, parent)
def set(self, txt):
#print txt
self.setText(txt)
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.grid=QGrid(2, self)
self.grid.setFrameShape(QFrame.StyledPanel)
self.setCentralWidget(self.grid)
self.le0=MyLineEdit(self.grid)
self.le1=MyLineEdit(self.grid)
self.le2=MyLineEdit(self.grid)
self.le3=MyLineEdit(self.grid)
self.bn1=QPushButton("Set Text", self.grid)
self.connect(self.bn1, SIGNAL("clicked()"), self.setLineEdit)
def setLineEdit(self):
MyLineEdit(self).set("hi")
def main(args):
app=QApplication(args)
win=MainWindow()
win.show()
app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
app.exec_loop()
if __name__=="__main__":
main(sys.argv)
More information about the PyQt
mailing list