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

Discussion in 'Python' started by ulysses, Sep 11, 2003.

  1. ulysses

    ulysses Guest

    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
     
    ulysses, Sep 11, 2003
    #1
    1. Advertising

  2. ulysses

    Lee Harr Guest

    In article <>, 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")
     
    Lee Harr, Sep 11, 2003
    #2
    1. Advertising

  3. ulysses

    ulysses Guest

    > 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.
     
    ulysses, Sep 13, 2003
    #3
  4. 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
     
    Phil Thompson, Sep 13, 2003
    #4
  5. ulysses

    ulysses Guest

    Phil Thompson <> wrote in message news:<>...
    > 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.
     
    ulysses, Sep 18, 2003
    #5
    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. Jay B. Harlow [MVP - Outlook]

    Re: FileDialog window handle

    Jay B. Harlow [MVP - Outlook], Sep 2, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    3,898
    Mick Doherty
    Sep 3, 2003
  2. ulysses
    Replies:
    4
    Views:
    778
    Werner Schiendl
    Oct 22, 2003
  3. Stewart

    Why are style objects initially null?

    Stewart, May 19, 2004, in forum: Javascript
    Replies:
    4
    Views:
    190
    Grant Wagner
    May 19, 2004
  4. Janis Papanagnou
    Replies:
    3
    Views:
    118
    Vince Morgan
    Dec 23, 2006
  5. david.karr
    Replies:
    0
    Views:
    213
    david.karr
    Mar 8, 2008
Loading...

Share This Page