Last active
May 19, 2021 06:35
-
-
Save rubyon/142f4bfb9d8965c4aab01e5c1f2ef9d6 to your computer and use it in GitHub Desktop.
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
require "gtk3" | |
builder_file = "#{File.expand_path(File.dirname(__FILE__))}/builder-thread.ui" | |
builder = Gtk::Builder.new(:file => builder_file) | |
window = builder.get_object("window") | |
window.signal_connect("destroy") do | |
Gtk.main_quit | |
end | |
button = builder.get_object("button") | |
button.signal_connect("clicked") do | |
Gtk.main_quit | |
end | |
def thread(button) | |
Thread.new do | |
count = 0 | |
while(true) | |
button.label="Click to Quit (#{count})" | |
count = count + 1 | |
sleep(0.1) | |
end | |
end | |
end | |
thread(button) | |
Gtk.main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment