Modify Exercise 10.4. Allow the user to select a temperature to be converted with a horizontal Scale. When the user interacts with the Scale, update the temperature conversion.
What will be an ideal response?
```
# GUI that offers temperature conversion with a Scale.
from Tkinter import *
class TemperatureConversion( Frame ):
"""Temperature conversion of user input"""
def __init__( self ):
"""Create an Entry widget and a button"""
Frame.__init__( self )
self.grid( sticky = W+E+N+S )
self.master.title( "Converting Temperature" )
self.master.rowconfigure( 0, weight = 1 )
self.master.columnconfigure( 0, weight = 1 )
# create a descriptive label
self.description = Label( self, text =
"Enter Fahrenheit temperature" )
self.description.grid( row = 0, column = 0,
sticky = W+E )
# create an Entry widget for the temperature
self.temperature = Entry( self, width = 30,
name = "temperature" )
self.temperature.insert( INSERT,
self.FahrenheitToCelsius( 10.0 ) )
self.temperature.grid( row = 1, column = 0,
sticky = W+E )
# create Scale
self.control = Scale( self, from_ = -273, to = 212,
orient = HORIZONTAL, command = self.updateTemperature )
self.control.grid( row = 2, column = 0, sticky = W+E )
self.control.set( 10 )
def FahrenheitToCelsius( self, temperature ):
"""Convert from Fahrenheit to Celsius"""
# returns answer
return ( ( 5.0 / 9 ) * ( temperature - 32 ) )
def updateTemperature( self, scaleValue ):
"""Delete previous temperature, convert scale value
and display converted temperature"""
self.temperature.delete( 0, END )
converted = self.FahrenheitToCelsius( float( scaleValue ) )
self.temperature.insert( INSERT, converted )
def main():
TemperatureConversion().mainloop()
if __name__ == "__main__":
main()
```

You might also like to view...
The Windows graphical user interface incorporates ____________________ and software.
Fill in the blank(s) with the appropriate word(s).
________ is the overall look and feel of a document
Fill in the blank(s) with correct word
What are the limitations of creating a CIDR address?
What will be an ideal response?
The clause WITH GRANT OPTION is meaningful as part of a REVOKE command.
Answer the following statement true (T) or false (F)