Guest User

Untitled

a guest
Feb 19th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. require "rubygems"
  2. gem "rubyscript2exe"
  3. require "rubyscript2exe"
  4.  
  5. RUBYSCRIPT2EXE.tk = true
  6.  
  7. RUBYSCRIPT2EXE.rubyw = true
  8. require 'tk'
  9.  
  10. class Lol
  11.  
  12. def run
  13. @window.mainloop
  14. end
  15. def initialize
  16. @window = TkRoot.new(:title => 'DUMM??', 'height' => 200, 'width' => 300) do
  17. root.geometry('+480+380')
  18. background 'orange'
  19. end
  20. button_ja()
  21. button_nein_1
  22. label
  23. end
  24.  
  25. def label
  26. TkLabel.new('height' => 1, 'width' => 20) do
  27. place 'x' => 10, 'y' => 20
  28. background 'yellow'
  29. foreground 'green'
  30. text 'Bist du eigentlich dumm??'
  31. font TkFont.new('times 18 bold')
  32. end
  33. end
  34.  
  35. def button_ja
  36. @bt = TkButton.new('height' => 1, 'width' => 5) do
  37. place 'x' => 20, 'y' => 120
  38. text 'JA'
  39. background 'red'
  40. foreground 'blue'
  41. font TkFont.new('times 20 bold')
  42. end
  43.  
  44. @bt.bind('ButtonRelease-1') do
  45. msgBox = Tk.messageBox(
  46. 'type' => "ok",
  47. 'icon' => "warning",
  48. 'title' => "",
  49. 'message' => "Hab ich es doch gewusst..."
  50. )
  51.  
  52. end
  53.  
  54. def button_nein_1
  55. @bt1 = TkButton.new('height' => 1, 'width' => 5) do
  56. place 'x' => 180, 'y' => 120
  57. text 'Nein'
  58. background 'blue'
  59. foreground 'red'
  60. font TkFont.new('times 20 bold')
  61. end
  62.  
  63. @bt1.bind('Enter') do
  64. @bt1.state = 'disabled'
  65. @bt1.configure('text', '')
  66. @bt1.configure('background', 'orange')
  67. @bt1.configure('relief', 'flat')
  68. @bt1.configure('foreground', 'orange')
  69. end
  70.  
  71. @bt1.bind('Leave') do
  72. @bt1.state = 'active'
  73. @bt1.configure('text', 'NEIN')
  74. @bt1.configure('background', 'blue')
  75. @bt1.configure('relief', 'raised')
  76. @bt1.configure('foreground', 'red')
  77. end
  78. end
  79. end
  80.  
  81. hehe = Lol.new
  82. hehe.run
  83. end
Add Comment
Please, Sign In to add comment