PyQt: Can't show PY variable in QT filedialog as initially parameter

U

ulysses

Hi,

I use PyQt 3.8 non-commercial version in win32. I get a big question.
I Can't show PY variable in QT filedialog as initially parameter.

Code sample is following:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fileName="test.avi"

def saveSomething(aString):
dl = QFileDialog.getSaveFileName(aString, "*.*", self, "FileDialog")
or
dl = QFileDialog.getSaveFileName(QString(aString), "*.*",
self, "FileDialog")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
these code can't show corrent string.

If I use string constant.
dl = QFileDialog.getSaveFileName("test.avi", "*.*", self, "FileDialog")

Dialog show it correctly.

Thanks.

Ulysses
 
L

Lee Harr

Hi,

I use PyQt 3.8 non-commercial version in win32. I get a big question.
I Can't show PY variable in QT filedialog as initially parameter.

Code sample is following:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fileName="test.avi"

def saveSomething(aString):
dl = QFileDialog.getSaveFileName(aString, "*.*", self, "FileDialog")
or
dl = QFileDialog.getSaveFileName(QString(aString), "*.*",
self, "FileDialog")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
these code can't show corrent string.

If I use string constant.
dl = QFileDialog.getSaveFileName("test.avi", "*.*", self, "FileDialog")

Dialog show it correctly.


Maybe try:

dl = QFileDialog.getSaveFileName(str(aString), "*.*", self, "FileDialog")
 
U

ulysses

Maybe try:
dl = QFileDialog.getSaveFileName(str(aString), "*.*", self, "FileDialog")

Thank you for you reply. I has try this code. str(aString). But it's still
can't work.

I has kill the question. code is following
strTemp=QString(' '+default)

dl = QFileDialog.getSaveFileName(strTemp, "*.*", self, "FileDialog")

Dialog show correctly. I read it from QT C++ document.
 
P

Phil Thompson

Hi,

I use PyQt 3.8 non-commercial version in win32. I get a big question.
I Can't show PY variable in QT filedialog as initially parameter.

Code sample is following:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fileName="test.avi"

def saveSomething(aString):
dl = QFileDialog.getSaveFileName(aString, "*.*", self, "FileDialog")
or
dl = QFileDialog.getSaveFileName(QString(aString), "*.*",
self, "FileDialog")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
these code can't show corrent string.

If I use string constant.
dl = QFileDialog.getSaveFileName("test.avi", "*.*", self, "FileDialog")

Dialog show it correctly.

Thanks.

Ulysses

Have you got a complete (but small) example that demonstrate's the problem?

Phil
 
U

ulysses

Phil Thompson said:
Have you got a complete (but small) example that demonstrate's the problem?

Phil

Above code is a example. I do a little application for free.
main form will arrive 1XXX line. So I can't post it all.

BTW: I can't show getExistingDirectory Dialog in a python thread.
it's will halt whole program.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top