<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Le 31/10/11 09:32, Matteo Boscolo a écrit :
    <blockquote cite="mid:4EAE5D25.8060704@boscolini.eu" type="cite">Try
      this after instantiate the application:
      <br>
      app.setQuitOnLastWindowClosed(False)
      <br>
      <br>
      and this after closing the dialog:
      <br>
      app.closeAllWindows()
      <br>
      <br>
      I use this in some case in my com application .. hope it helps
      <br>
      <br>
      Regards,
      <br>
      Matteo
      <br>
      <br>
      <br>
      <br>
      Il 31/10/2011 09:08, Janwillem ha scritto:
      <br>
      <blockquote type="cite">Thanks, yes I see, that is under windows
        (XP on VirtualBox, python 2.7.1 and
        <br>
        pyqt4 4.7.2 in my case) but under linux (ubuntu 11.10, python
        2.7.2+ and
        <br>
        pyqt 4.7.3) it only closes after the sleep has finished (or in
        case of my
        <br>
        practical application, until the data processing finished)
        <br>
        So any tips from a ubuntu user???
        <br>
        cheers, Janwillem
        <br>
        <br>
        <br>
        Matteo Boscolo wrote:
        <br>
        <blockquote type="cite">with this configuration
          <br>
          Python 2.6.6
          <br>
          PyQt4 4.7.3
          <br>
          open dialog
          <br>
          dialog finished
          <br>
          C:\Users\mboscolo\Documents\.bzr.log
          <br>
          finished
          <br>
          <br>
          it works perfectly .. after press the opendialog the form is
          closed and
          <br>
          start to print the rest of the debug
          <br>
          <br>
          regards,
          <br>
          Matteo
          <br>
          <br>
          Il 31/10/2011 08:07, Janwillem ha scritto:
          <br>
          <blockquote type="cite">I want a small script with just a few
            filedialogs not a full blown gui
            <br>
            application . However when I try the code below the dialog
            does not
            <br>
            disappear after clicking the Open button on the dialog  but
            stays on top
            <br>
            until the script exits. What am I doing wrong??
            <br>
            Thanks, Janwillem
            <br>
            <br>
            def open_files(default_dir=None):
            <br>
                  """Returns list of filenames optionally given a
            default dir"""
            <br>
                  from sys import argv
            <br>
                  from os import environ
            <br>
                  from PyQt4.QtGui import QApplication,
            QFileDialog,QWidget
            <br>
                  if default_dir == None:
            <br>
                      default_dir = environ['HOME']
            <br>
                  app = QApplication(argv)
            <br>
                  fdialog = QFileDialog
            <br>
                  filenames =
            fdialog.getOpenFileNames(directory=default_dir)
            <br>
                  app.exit()
            <br>
                  return list(filenames)
            <br>
            <br>
            if __name__ == '__main__':
            <br>
                  from PyQt4.QtCore import QT_VERSION_STR
            <br>
                  from platform import python_version
            <br>
                  print('Python %s' % (python_version()))
            <br>
                  print('PyQt4 %s' %QT_VERSION_STR)
            <br>
                  print('open dialog')
            <br>
                  lst = open_files()
            <br>
                  print('dialog finished')
            <br>
                  for fname in lst:
            <br>
                      print(fname)
            <br>
                  import time
            <br>
                  time.sleep(2)
            <br>
                  print 'finished'
            <br>
            <br>
          </blockquote>
          _______________________________________________
          <br>
          PyQt mailing list    <a class="moz-txt-link-abbreviated" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
          <br>
          <a class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a>
          <br>
          <br>
          <br>
        </blockquote>
      </blockquote>
      <br>
      _______________________________________________
      <br>
      PyQt mailing list    <a class="moz-txt-link-abbreviated" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
      <br>
      <a class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a>
      <br>
      <br>
    </blockquote>
    No problem for me on Ubuntu 10.04<br>
    <br>
    vincent@tiemoko:~/Bureau$ python test.py <br>
    Python 2.6.5<br>
    PyQt4 4.6.2<br>
    open dialog<br>
    dialog finished<br>
    /home/vincent/Documents/gabarit_cd.svg<br>
    finished<br>
    vincent@tiemoko:~/Bureau$<br>
    <br>
    <div class="moz-signature">-- <br>
      Vincent V.V.<br>
      <a href="https://launchpad.net/oqapy">Oqapy</a> . <a
        href="https://launchpad.net/qarte+7">Qarte+7</a> . <a
        href="https://launchpad.net/paqager">PaQager</a></div>
  </body>
</html>