From: Juju SL Newsgroups: comp.lang.ruby Subject: Re: Tk : non blocking Tk.mainloop Date: Mon, 2 May 2011 15:46:55 -0500 Organization: Service de news de lacave.net Lines: 75 Message-ID: References: <58d66ab4de539ec84adb59d9fbde9312@ruby-forum.com> NNTP-Posting-Host: bristol.highgroove.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: Quoted-printable X-Trace: talisker.lacave.net 1304369392 1343 65.111.164.187 (2 May 2011 20:49:52 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Mon, 2 May 2011 20:49:52 +0000 (UTC) In-Reply-To: <58d66ab4de539ec84adb59d9fbde9312@ruby-forum.com> X-Received-From: This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway X-Mail-Count: 382555 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!talisker.lacave.net!lacave.net!not-for-mail Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:3850 So, I patched manually the tk.rb file : =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # diff tk.rb.ORIG tk.rb 1238a1239,1241 > interp.mainloop_abort_on_exception =3D true > Thread.current.instance_variable_set("@interp", interp) > 1273a1277,1279 > # complete initializing > ruby {TkCore::INTERP_THREAD[:interp] =3D TkCore::INTERP_THREAD.instance_variable_get('@interp')} > 1280,1281c1286,1287 < interp.mainloop_abort_on_exception =3D true < Thread.current[:interp] =3D interp --- > # interp.mainloop_abort_on_exception =3D true > # Thread.current[:interp] =3D interp 1286a1293 > p e if $DEBUG 1302a1310 > # check a Tcl/Tk interpreter is initialized 1304c1312,1313 < Thread.pass --- > # Thread.pass > INTERP_THREAD.run 1308a1318,1322 > # check an eventloop is running > while INTERP_THREAD.alive? && TclTkLib.mainloop_thread?.nil? > INTERP_THREAD.run > end > 1318a1333,1336 > > # (for safety's sake) force the eventloop to run > INTERP_THREAD.run > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Unfortunately, my small scripts ends with an exception : =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D tcltklib: delete slaves tcltklib: destroy root widget tcltklib: check `finalize-hook-proc' tcltklib: check `foreach' & `after' tcltklib: cancel after callbacks tcltklib: finish ip_finalize Exception `TypeError' at /usr/lib/ruby/1.9.1/tk.rb:1288 - exception class/object expected tcltklib: eventloop_ensure: current-thread : 9e62658 tcltklib: eventloop_ensure: eventloop-thread : 9e62658 tcltklib: eventloop-ensure: new eventloop-thread -> 4 tcltklib: finish current eventloop 9e62658 tcltklib: ip is deleted tcltklib: ip is deleted tcltklib: ip is deleted tcltklib: delete deleted IP tcltklib: free Tcl Interp 9e7ae68 tcltklib: complete freeing Tcl Interp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Line 1288 is : Thread.current[:status].value =3D interp.mainloop(true) Best regards St=C3=A9phane -- = Posted via http://www.ruby-forum.com/.=