From: Jim I. <ji...@ap...> - 2017-12-01 18:19:51
|
You are not supposed to use AppKit (underlying Tk on macOS) on anything but the main thread. The Xcode team even added a "Main Thread Checker" tool in the latest version of Xcode to flag uses of AppKit not on the main thread: https://developer.apple.com/documentation/code_diagnostics/main_thread_checker Jim > On Dec 1, 2017, at 6:03 AM, Programmingkid <pro...@gm...> wrote: > >> >> On Dec 1, 2017, at 1:30 AM, Steve Landers <st...@di...> wrote: >> >> Should Tk work in a thread on MacOS ? >> >> The following script works on Linux and Windows, but not MacOS the toplevel window resizes but the label doesn’t appear. >> >> I can’t find any documentation that says it shouldn’t work. >> package require Thread >> set id [thread::create] >> thread::send $id { >> package require Tk >> label .l1 -text "This is a label" >> grid configure .l1 >> } >> >> It seems the grid is the problem, because I can see the label widget exists. Replacing grid with a pack doesn’t fix it. >> >> Can anyone shed some light? >> >> —Steve > > It is common for GUI frameworks to only want to use the main thread for all their GUI work. > > When I tried out your code in wish I saw the label, so it works for me. Only when I tried quitting the application an exception occurred. > > My info: > TK 8.5.9 > Mac OS 10.12.6 > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Tcl-mac mailing list > tc...@li... > https://lists.sourceforge.net/lists/listinfo/tcl-mac |