Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3850

Re: Tk : non blocking Tk.mainloop

From Juju SL <jujusl@free.fr>
Newsgroups comp.lang.ruby
Subject Re: Tk : non blocking Tk.mainloop
Date 2011-05-02 15:46 -0500
Organization Service de news de lacave.net
Message-ID <beee0c75cd89cf0fa720304393532c71@ruby-forum.com> (permalink)
References <58d66ab4de539ec84adb59d9fbde9312@ruby-forum.com>

Show all headers | View raw


So, I patched manually the tk.rb file :
=====================================
# diff tk.rb.ORIG tk.rb

1238a1239,1241
>         interp.mainloop_abort_on_exception = true
>         Thread.current.instance_variable_set("@interp", interp)
>
1273a1277,1279
> # complete initializing
> ruby {TkCore::INTERP_THREAD[:interp] =
TkCore::INTERP_THREAD.instance_variable_get('@interp')}
>
1280,1281c1286,1287
<             interp.mainloop_abort_on_exception = true
<             Thread.current[:interp] = interp
---
> #            interp.mainloop_abort_on_exception = true
> #            Thread.current[:interp] = 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
>
=====================================

Unfortunately, my small scripts ends with an exception :
=====================================
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
=====================================
Line 1288 is : Thread.current[:status].value = interp.mainloop(true)

Best regards
Stéphane

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Tk : non blocking Tk.mainloop Juju SL <jujusl@free.fr> - 2011-04-13 12:20 -0500
  Re: Tk : non blocking Tk.mainloop botp <botpena@gmail.com> - 2011-04-13 18:02 -0500
  Re: Tk : non blocking Tk.mainloop Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> - 2011-04-24 17:16 -0500
  Re: Tk : non blocking Tk.mainloop Juju SL <jujusl@free.fr> - 2011-04-28 16:03 -0500
    Re: Tk : non blocking Tk.mainloop Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> - 2011-04-29 04:48 -0500
  Re: Tk : non blocking Tk.mainloop Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> - 2011-04-29 17:27 -0500
    Re: Tk : non blocking Tk.mainloop Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> - 2011-05-02 04:51 -0500
  Re: Tk : non blocking Tk.mainloop Juju SL <jujusl@free.fr> - 2011-04-29 14:37 -0500
  Re: Tk : non blocking Tk.mainloop Juju SL <jujusl@free.fr> - 2011-05-02 15:46 -0500
    Re: Tk : non blocking Tk.mainloop Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> - 2011-05-02 21:21 -0500
      Re: Tk : non blocking Tk.mainloop Patrick Lynch <kmandpjlynch@verizon.net> - 2011-05-03 08:52 -0500
        Re: Tk : non blocking Tk.mainloop Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> - 2011-05-04 08:14 -0500
          Forward delete with irb on a iMac Snow Leopeard machine... Patrick Lynch <kmandpjlynch@verizon.net> - 2011-05-04 11:45 -0500
            Re: Forward delete with irb on a iMac Snow Leopeard machine... Stu <stu@rubyprogrammer.net> - 2011-05-04 12:31 -0500
              Re: Forward delete with irb on a iMac Snow Leopeard machine... Patrick Lynch <kmandpjlynch@verizon.net> - 2011-05-05 10:38 -0500
      Re: Tk : non blocking Tk.mainloop Juju SL <jujusl@free.fr> - 2011-05-05 15:11 -0500
        Re: Tk : non blocking Tk.mainloop Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> - 2011-05-06 17:28 -0500
  Re: Tk : non blocking Tk.mainloop Akshay Jangid <akshay.dce@gmail.com> - 2011-05-04 13:01 -0500
  Re: Tk : non blocking Tk.mainloop Akshay Jangid <akshay.dce@gmail.com> - 2011-05-05 03:19 -0500
  Re: Tk : non blocking Tk.mainloop Juju SL <jujusl@free.fr> - 2011-05-16 14:15 -0500
    Re: Tk : non blocking Tk.mainloop Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> - 2011-05-19 14:59 -0500

csiph-web