By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,491 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,491 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <43**************************@posting.google.com >, ulysses wrote:
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")

Jul 18 '05 #2

P: n/a
> 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.
Jul 18 '05 #3

P: n/a
On Thursday 11 September 2003 5:14 pm, ulysses wrote:
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
Jul 18 '05 #4

P: n/a
Phil Thompson <ph**@riverbankcomputing.co.uk> wrote in message news:<ma*********************************@python.o rg>...
On Thursday 11 September 2003 5:14 pm, ulysses wrote:
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


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.
Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.