-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When a executable Tk library script, e.g. "sample/tktextio.rb",
is executed as a command, it may need to run the eventloop other than the main thread. However, when loaded as a library, it should not force the running-mode of the eventloop. "thread_tk.rb" is one solution to the problem by writing a sh-bang line like "#!/usr/bin/ruby -r thread_tk". fix that sample/irbtkw.rbw doesn't work with the recent IRB
- Loading branch information
1 parent
628485a
commit 2ff1050
Showing
6 changed files
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# | ||
# thread_tk.rb : | ||
# The eventloop of Tk (Tk.mainloop) can run on a thread other than the | ||
# main thread. That is, when "require 'thread_tk'" is executed instead | ||
# of or before "require 'tk'", "Thread.new{Tk.mainloop}" works properly. | ||
# | ||
module TkCore; RUN_EVENTLOOP_ON_MAIN_THREAD = false; end | ||
require 'tk' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/usr/bin/env ruby -r thread_tk | ||
# -*- coding: utf-8 -*- | ||
# frozen_string_literal: false | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters