Created
August 17, 2008 22:03
-
-
Save anonymous/5840 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 'tk' | |
class BMI | |
def run | |
@window.mainloop | |
end | |
def initialize | |
@window = TkRoot.new(:title => 'BMI', 'height' => 304, 'width' => 258) do | |
root.geometry('+40+50') | |
end | |
TkLabel.new do | |
text 'Geben sie bitte hier ihr Gewicht ein:' | |
place 'x' => 50, 'y' => 10 | |
end | |
@lol = TkText.new('height' => 2, 'width' => 9 ) do | |
place 'x' => 50, 'y' => 40 | |
end | |
TkLabel.new do | |
text 'Geben sie bitte hier ihre Groese ein:' | |
place 'x' => 50, 'y' => 80 | |
end | |
@lol1 = TkText.new('height' => 2, 'width' => 9 ) do | |
place 'x' => 50, 'y' => 120 | |
end | |
TkLabel.new do | |
text 'Dies ist ihr BMI' | |
place 'x' => 50, 'y' => 160 | |
end | |
TkText.new do | |
place 'x' => 50, 'y' => 200 | |
text "#{hallo.to_i / (hallo1.to_f **2)}" | |
end | |
button | |
end | |
def button | |
TkButton.new('height' => 2, 'width' => 10) do | |
text "BMI Berechnen" | |
place 'x' => 50, 'y' => 150 | |
end | |
button.bind('ButtonRelease-1') do | |
hallo = @lol.text | |
hallo1 = @lol1.text | |
end | |
end | |
lol = BMI.new | |
lol.run | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment