in reply to Tk and native controls do not play along on Windows

Essentially, you'd need to service both message queues concurrently. Tk has calls that allow you to service it's queue without entering MainLoop, but there probably isn't any effective way to call them once you've entered the native control's dispatch loop.

It would be worth trying invoking the ShBrowseForFolder() api from within a thread:

use threads; asynch { ShBrowseForFolder( ... ); }->detach;

That should allow the main thread to run the Tk MainLoop concurrently with the Native controls dispatch loop.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Tk and native controls do not play along on Windows
by nikosv (Deacon) on Jan 20, 2011 at 10:16 UTC
    It would be worth trying invoking the ShBrowseForFolder() api from within a thread

    that was one of my intial approaches,which works perfectly painting wise,but the app breaks shortly after since Tk is not thread safe

      but the app breaks shortly after since Tk is not thread safe

      Then only use Tk from one thread. Really, it works just fine.

      If you'd care to post your working but crashing code, I'll show you how to stop it from crashing.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        sure,I will have to trim it down to the essential point since it is part of a large program with unrelated functionality,and send it to you.
      since Tk is not thread safe

      It doesn't matter if you only load Tk in one thread, see BrowserUks replies to Tk + threads and Tk and Threads