aboutsummaryrefslogtreecommitdiffstats
path: root/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb
blob: 4cbf4416c09faaa5a1872470826f0f862cfc2fa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env ruby
# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'

sh = Tk::Iwidgets::Shell.new(:modality=>:application,
                             :padx=>20, :pady=>20, :title=>'Shell')

TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7,
             :command=>proc{puts sh.activate}).pack(:padx=>10, :pady=>10)

TkLabel.new(sh.child_site, :text=>'SHELL').pack
TkButton.new(sh.child_site, :text=>'YES',
             :command=>proc{sh.deactivate 'press YES'}).pack(:fill=>:x)
TkButton.new(sh.child_site, :text=>'NO',
             :command=>proc{sh.deactivate 'press NO'}).pack(:fill=>:x)

Tk.mainloop