Guest

Untitled

By: a guest on Jan 28th, 2012  |  syntax: None  |  size: 0.97 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. #! /usr/bin/ruby
  2.  
  3. require 'tk'
  4.  
  5.  
  6. entry1 = ""
  7.  
  8. def myproc
  9.   puts entry1
  10.  
  11. end
  12.  
  13.  
  14.  
  15. root = TkRoot.new
  16. root.title = "Camera Downloader V.01"
  17.  
  18. entry1 = TkEntry.new(root)
  19. entry2 = TkEntry.new(root)
  20.  
  21. variable1 = TkVariable.new
  22. variable2 = TkVariable.new
  23. entry1.textvariable = variable1
  24. entry2.textvariable = variable2
  25. variable1.value = "Enter any text value"
  26. variable2.value = "Enter any confidential value"
  27.  
  28. btn_OK = TkButton.new(root) do
  29.   text "OK"
  30.   borderwidth 5
  31.   underline 0
  32.   state "normal"
  33.   cursor "watch"
  34.   font TkFont.new('times 20 bold')
  35.   foreground  "red"
  36.   activebackground "blue"
  37.   relief      "groove"
  38.   command (proc {myproc})
  39.   pack("side" => "bottom","padx"=> "50", "pady"=> "100"
  40. )
  41. end
  42.  
  43.  
  44. entry1.place('height' => 25,
  45.             'width'  => 150,
  46.             'x'      => 10,
  47.             'y'      => 10)
  48.  
  49. entry2.place('height' => 25,
  50.             'width'  => 150,
  51.             'x'      => 10,
  52.             'y'      => 40)
  53.  
  54. Tk.mainloop