class Gui
Public Class Methods
entry(var, x, y, xx, yy)
click to toggle source
__ method to draw an entry field sending value to variable (var)[ use $var1 to $var3]
# File lib/gui.rb, line 69 def self.entry(var, x, y, xx, yy) TkEntry.new(root){ textvariable var borderwidth 5 }.grid('row' => x, 'column' => y, 'rowspan' => xx, 'columnspan' => yy) end
header(text, x, y, xx, yy)
click to toggle source
_ LABELS _
# File lib/gui.rb, line 15 def self.header(text, x, y, xx, yy) $header = TkLabel.new(root){ text "#{text}" font TkFont.new('Times 14 bold') borderwidth 4 relief "groove" justify "left" }.grid('row' => x, 'column' => y, 'rowspan' => xx, 'columnspan' => yy, 'sticky' => 'WE') end
label(text, x, y, xx, yy)
click to toggle source
# File lib/gui.rb, line 25 def self.label(text, x, y, xx, yy) $header = TkLabel.new(root){ text "#{text}" font TkFont.new('Times 14 bold') borderwidth 4 background "yellow" relief "groove" justify "left" }.grid('row' => x, 'column' => y, 'rowspan' => xx, 'columnspan' => yy) end
listbox(name, listvar, x, y, xx, yy)
click to toggle source
its_command = proc.new{system ‘notepad’} _ LISTBOXES __
# File lib/gui.rb, line 52 def self.listbox(name, listvar, x, y, xx, yy) name = TkListbox.new(root){ setgrid 1 height 5 width 20 font TkFont.new('Tahoma 14 normal') listvariable listvar }.grid('row' => x, 'column' => y, 'rowspan' => xx, 'columnspan' => yy) end
root()
click to toggle source
__ ROOT __
# File lib/gui.rb, line 7 def self.root root = TkRoot.new{ title "#$title" } end
scrollbar()
click to toggle source
__ SCROLLBARS _
# File lib/gui.rb, line 95 def self.scrollbar $scrollbar = TkScrollbar.new(root){command proc{ |*args| list_right.yview(* args) list_left.yview(* args)} } list_right.yscrollcommand(proc { |first, last| scrollbar1.set(first, last) } ) list_left.yscrollcommand(proc { |first, last| scrollbar1.set(first, last) } ) end
show()
click to toggle source
__ SHOW _
# File lib/gui.rb, line 154 def self.show Tk.mainloop end
textfield(data, x, y, xx, yy)
click to toggle source
__ TEXT __
# File lib/gui.rb, line 76 def self.textfield(data, x, y, xx, yy) $text = TkText.new(root) do width 70 height 20 setgrid 'true' background "black" foreground "white" font TkFont.new('tahoma 16 normal') wrap 'word' insertbackground "yellow" insertwidth 10 cursor "draft_large" end.grid('row' => x, 'column' => y, 'rowspan' => xx, 'columnspan' => yy) $text.focus $text.insert('1.0', "#{data}") end