[PyKDE] Printing empty QStrings

Pete Ware ware at cis.ohio-state.edu
Thu Nov 2 17:11:55 GMT 2000


I had to do a bunch of work to go from python 1.5.2 to python 1.6 &
PyQt 2.0 because of the string changes.  I have a lot of code
fragments that look like:

        # From a qt.QLineEdit object
        text = self.comment.text ()
        if text.length() == 0:
                text = ''
        else:
                text = str (text)

and

        # From a file dialog
        filename = qt.QFileDialog.getSaveFileName (init, '',
                        self.parent, 'Save the .submit as')
        if filename.isNull():
                return
        filename = str (filename)

I doubt there is one best answer so sticking with something is
probably the solution.

--pete




More information about the PyQt mailing list