<div dir="ltr"><div class="markdown-here-wrapper" id="markdown-here-wrapper-846946" style><p style="margin:1.2em 0px!important">Hi Frank,</p>
<p style="margin:1.2em 0px!important">The example that I provided Janwillem in his thread about QFileDialog shows two ways to wait for a thread: one by connect the thread’s <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline">wait()</code> slot to QApplication’s <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline">aboutToQuit</code> signal, the other by overriding <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline">closeEvent()</code> on the main widget. Comments in the code explain the two approaches.</p>


<p style="margin:1.2em 0px!important">Hope this helps,</p>
</div><div></div><div></div></div><div class="gmail_extra"><br clear="all"><div><div><br></div><div>--</div><div>Sean Fisk</div></div>
<br><br><div class="gmail_quote">On Mon, Dec 16, 2013 at 2:28 PM, Frank Rueter | OHUfx <span dir="ltr"><<a href="mailto:frank@ohufx.com" target="_blank">frank@ohufx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    ah, that makes perfect sense, thank you!<div><div class="h5"><br>
    <br>
    <div>On 17/12/13 02:54, Dan McCombs wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hey Frank,
        <div><br>
        </div>
        <div>I think the real reason you're getting that message isn't
          the subclassing piece, but that your program is exiting before
          the thread has finished. There's nothing in your application
          to keep it running after running the doIt method, so it exits,
          and destroys the thread. Normally you would have a
          QApplication instance and be calling the exec_ method on that
          after doIt to start your application's event loop and keep it
          running, until it was quit via some user interaction.</div>
        <div><br>
        </div>
        <div>-Dan</div>
      </div>
      <div class="gmail_extra"><br clear="all">
        <div>
          <div dir="ltr">
            <p style="line-height:17.328125px;color:rgb(51,51,51);padding:0px;margin-bottom:10px;font-family:Arial,Helvetica,FreeSans,sans-serif"><a href="http://dyn.com/" rel="nofollow" style="color:rgb(0,109,175);outline:none" target="_blank"><img alt="Dyn
                  logo, Dyn.com" src="http://dyn.com/wp-content/uploads/2013/08/dyn-logo-esignature.png" style="border:none"></a>        <a href="http://twitter.com/dyn" rel="nofollow" style="color:rgb(0,109,175);outline:none" target="_blank"><img src="http://dyn.com/wp-content/uploads/2013/08/esignature-icon-dyn-twitter.png" style="border:none"></a>   <a href="http://facebook.com/dyn" rel="nofollow" style="color:rgb(0,109,175);outline:none" target="_blank"><img alt="Dyn
                  facebook account" src="http://dyn.com/wp-content/uploads/2013/08/esignature-icon-dyn-facebook.png" style="border:none"></a>   <a href="http://linkedin.com/company/dyn" rel="nofollow" style="color:rgb(0,109,175);outline:none" target="_blank"><img alt="Dyn
                  LinkedIn account" src="http://dyn.com/wp-content/uploads/2013/08/esignature-icon-dyn-linkedin.png" style="border:none"></a></p>
            <p style="line-height:17.328125px;color:rgb(51,51,51);padding:0px;margin-bottom:10px;font-family:Arial,Helvetica,FreeSans,sans-serif"><span style="font-family:'Trebuchet MS';line-height:19px"><span style="background-color:rgb(255,249,37);color:rgb(0,0,0)">Dan McCombs</span> 
                / <span style="color:rgb(102,102,102)">Senior Software
                  Engineer</span> <br>
                <span style="color:rgb(102,102,102)"><img alt="" src="http://dyn.com/wp-content/uploads/2013/08/esignature-icon-phone.png" style="border:0px"> <a href="tel:603%20296%201568" value="+16032961568" target="_blank">603 296 1568</a>     <img alt="" src="http://dyn.com/wp-content/uploads/2013/08/esignature-icon-twitter.png" style="border:0px"> <span style="color:rgb(51,51,51)"><a href="http://twitter.com/danmccombs/" rel="nofollow" style="text-decoration:none;color:rgb(0,0,0);outline:none;background-color:rgb(255,249,37);background-repeat:initial initial" target="_blank"><span style="color:rgb(51,51,51)">@danmccombs</span></a> </span></span></span></p>


          </div>
        </div>
        <br>
        <br>
        <div class="gmail_quote">On Mon, Dec 16, 2013 at 2:01 AM, Frank
          Rueter | OHUfx <span dir="ltr"><<a href="mailto:frank@ohufx.com" target="_blank">frank@ohufx.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            Hi all,<br>
            <br>
            <br>
            I am playing with simple QThread object and am getting the
            ol' "QThread:<br>
            Destroyed while thread is still running" error.<br>
            <br>
            I have searched the web quite a bit now and keep running
            into examples<br>
            that do exactly what I am doing, except it seems to work for
            others.<br>
            Can somebody tell me where I'm going wrong with this bare
            bones examples<br>
            please?<br>
            <br>
            Cheers,<br>
            frank<br>
            <br>
            from PySide import QtCore<br>
            import time<br>
            <br>
            class MyThread(QtCore.QThread):<br>
            <br>
                 def __init__(self, parent=None):<br>
                     super(MyThread, self).__init__(parent)<br>
            <br>
                 def run(self):<br>
                     for i in xrange(10):<br>
                         print i<br>
                         time.sleep(1)<br>
            <br>
            class MainApp(QtCore.QObject):<br>
            <br>
                 def __init__(self, parent=None):<br>
                     super(MainApp, self).__init__(parent)<br>
                     self.thread = MyThread(self)<br>
            <br>
                 def doIt(self):<br>
                     self.thread.start()<br>
            <br>
            if __name__ == '__main__':<br>
                 a = MainApp()<br>
                 a.doIt()<br>
            <br>
            _______________________________________________<br>
            PySide mailing list<br>
            <a href="mailto:PySide@qt-project.org" target="_blank">PySide@qt-project.org</a><br>
            <a href="http://lists.qt-project.org/mailman/listinfo/pyside" target="_blank">http://lists.qt-project.org/mailman/listinfo/pyside</a><br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
PySide mailing list<br>
<a href="mailto:PySide@qt-project.org">PySide@qt-project.org</a><br>
<a href="http://lists.qt-project.org/mailman/listinfo/pyside" target="_blank">http://lists.qt-project.org/mailman/listinfo/pyside</a><br>
<br></blockquote></div><br></div>