[PyKDE] problem about LineEdit

wqh pyqt at 263.net
Mon Jun 18 03:30:03 BST 2001


def my(self):
       # from telnetlib import Telnet
        self.LineEdit1.setText("bbs")
        a=self.LineEdit1.maxLength
        print a

I want it print the context of the LineEdit1 ,But it said :
        <built-in method maxLength of QLineEdit object at 0x81528c0>
        What is the problem?

the following is the whole program:



#!/usr/bin/env python
import sys
from qt import *
class Form1(QDialog):
    def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        QDialog.__init__(self,parent,name,modal,fl)

        if name == None:
            self.setName('Form1')

        self.resize(330,221)
        self.setCaption(self.tr('Form1'))

        self.LineEdit1 = QLineEdit(self,'LineEdit1')
        self.LineEdit1.setGeometry(QRect(60,30,110,23))
        self.LineEdit1.setText(self.tr('bbs.whnet.edu.cn'))

        self.MultiLineEdit1 = QMultiLineEdit(self,'MultiLineEdit1')
        self.MultiLineEdit1.setGeometry(QRect(60,80,210,89))

        self.PushButton2 = QPushButton(self,'PushButton2')
        self.PushButton2.setGeometry(QRect(190,30,106,32))
        self.PushButton2.setText(self.tr('ok'))

        self.connect(self.PushButton2,SIGNAL('clicked()'),self.my)

    def my(self):
        self.LineEdit1.setText("bbs")
        a=self.LineEdit1.maxLength
        print a


if __name__ == '__main__':
    a = QApplication(sys.argv)
    QObject.connect(a,SIGNAL('lastWindowClosed()'),a,SLOT('quit()'))
    w = Form1()
    a.setMainWidget(w)
    w.show()
    a.exec_loop()


_____________________________________________
[×ã²»³ö»§ ÇáËÉÉÏÍø] ÉÏÍøרÓúţº95963£¬Óû§Ãû/ÃÜÂ룺263
Ìػݾ«Æ·¿Õµ÷ÂòÓÖËÍ  http://shopping.263.net/hotsale/aircondition/index.asp




More information about the PyQt mailing list