source-code/screens/quantum-screens/photon_energy_screen.rb
# Draws the photon energy screen on the Shoes app window.
Draws the photon energy screen on the Shoes app window.
Draws the photon energy screen on the Shoes app window .
def photon_energy_screen
    @heading = 'Photon energy = planck constant × frequency'
    background('images/quantum_large.png')
    ScreenHeader.new(self, '/title_screen/quantum_screen', @@font, @heading)
    flow(:height => 640, :width => 1080, :scroll => true) do
      stack(:height => 640, :width => 80) do
      end
      stack(:height => 640, :width => 1000) do
        ScreenLabel.new(self, @@font, @heading, 'Frequency')
        flow do
          @frequency = ScreenEditLine.new(self, @@font, @heading)
          @frequency_unit = para(strong(' Hz'))
          @frequency_unit.style(@@screen_unit_text_styles)
        end
        @calculate = button('Calculate')
        @result_display = flow
        @error_display = flow
        @calculate.click do
          @result_display.clear do
            @result = Joules.photon_energy(@frequency.text.to_f)
            @photon_energy = para(@result.to_s)
            @photon_energy_unit = para(' J')
            @photon_energy.style(@@screen_result_text_styles)
            @photon_energy_unit.style(@@screen_result_text_styles)
          end
        end
      end
    end
  end
def photon_energy_screen @heading = 'Photon energy = planck constant × frequency' background ( 'images/quantum_large.png' ) ScreenHeader . new ( self , '/title_screen/quantum_screen' , @@font , @heading ) flow ( :height => 640 , :width => 1080 , :scroll => true ) do stack ( :height => 640 , :width => 80 ) do end stack ( :height => 640 , :width => 1000 ) do ScreenLabel . new ( self , @@font , @heading , 'Frequency' ) flow do @frequency = ScreenEditLine . new ( self , @@font , @heading ) @frequency_unit = para ( strong ( ' Hz' ) ) @frequency_unit . style ( @@screen_unit_text_styles ) end @calculate = button ( 'Calculate' ) @result_display = flow @error_display = flow @calculate . click do @result_display . clear do @result = Joules . photon_energy ( @frequency . text . to_f ) @photon_energy = para ( @result . to_s ) @photon_energy_unit = para ( ' J' ) @photon_energy . style ( @@screen_result_text_styles ) @photon_energy_unit . style ( @@screen_result_text_styles ) end end end end end
Draws the photon energy screen on the Shoes app window.
Draws the photon energy screen on the Shoes app window .
# Photon energy screen header # Photon energy screen content # Left margin offset # Content column