strange QLineEdit problem in PyQt

Discussion in 'Python' started by taco, Mar 16, 2011.

  1. taco

    taco Guest

    hi,
    I have a form containing a few QLineedits and I wish to retrieve the
    contents only after pressing a QPushButton.
    a looks like:
    class Contract(QtGui.QWidget):
    def __init__(self,fileInfo, parent=None):
    QtGui.QWidget.__init__(self,parent)
    self.name = QtGui.QLineEdit("")
    .....
    self.createDoc = QtGui.QPushButton("do it")
    self.connect(createDoc,QtCore.SIGNAL("clicked()"),self.Foo)
    mainLayout.addWidget(self.name)
    mainLayout.addWidget(sef.createDoc)

    def Foo(self):
    print self.name.text()

    when executing this I get only a few characters back from the line. It's
    incomplete. How to retrieve the complete string? I don't need a signal for
    every typed character.

    taco
    taco, Mar 16, 2011
    #1
    1. Advertising

  2. taco

    taco Guest

    taco wrote:

    ah, I solved it myself. for completeness reasons. I had upgraded python for
    reportlab which needed this python version, while still using a pyqt which
    was compiled for 2.6. After compilation and changing pythonpath to the right
    site-packages dir it's working


    > hi,
    > I have a form containing a few QLineedits and I wish to retrieve the
    > contents only after pressing a QPushButton.
    > a looks like:
    > class Contract(QtGui.QWidget):
    > def __init__(self,fileInfo, parent=None):
    > QtGui.QWidget.__init__(self,parent)
    > self.name = QtGui.QLineEdit("")
    > .....
    > self.createDoc = QtGui.QPushButton("do it")
    > self.connect(createDoc,QtCore.SIGNAL("clicked()"),self.Foo)
    > mainLayout.addWidget(self.name)
    > mainLayout.addWidget(sef.createDoc)
    >
    > def Foo(self):
    > print self.name.text()
    >
    > when executing this I get only a few characters back from the line. It's
    > incomplete. How to retrieve the complete string? I don't need a signal for
    > every typed character.
    >
    > taco
    taco, Mar 16, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lupe
    Replies:
    3
    Views:
    303
    Lawrence Oluyede
    Aug 27, 2003
  2. ulysses
    Replies:
    4
    Views:
    754
    Werner Schiendl
    Oct 22, 2003
  3. Bulba!

    PyQt installation problem

    Bulba!, Dec 29, 2004, in forum: Python
    Replies:
    0
    Views:
    358
    Bulba!
    Dec 29, 2004
  4. aljosa
    Replies:
    0
    Views:
    509
    aljosa
    Jul 1, 2005
  5. freud

    strange behavior with PyQt

    freud, Aug 22, 2009, in forum: Python
    Replies:
    0
    Views:
    244
    freud
    Aug 22, 2009
Loading...

Share This Page