Rewrite the Python program of Fig. 11.2. Create a multiple-selection list of colors. Al- low the user to select one or more colors and copy them to a ScrolledText component.
What will be an ideal response?
```
# Creating a multiple selection list.
from Tkinter import *
import Pmw
class ChoiceBox( Frame ):
"""Demonstrate multiple-selection lists"""
def __init__( self, listItems ):
"""Create multiple-selection list, Button and
ScrolledText"""
Frame.__init__( self )
Pmw.initialise()
self.pack( expand = YES, fill = BOTH )
self.master.title( "Select colors" )
# create a multiple-selection scrolled list box
self.listBox = Pmw.ScrolledListBox( self, items =
listItems, listbox_height = 5, vscrollmode = "static",
listbox_selectmode = MULTIPLE )
self.listBox.pack( side = LEFT, expand = YES, fill = BOTH,
padx = 5, pady = 5 )
self.copyButton = Button( self, text = "Copy >>>",
command = self.addColor )
self.copyButton.pack( side = LEFT, padx = 5, pady = 5 )
self.chosen = Pmw.ScrolledText( self, text_height = 6,
text_width = 20 )
self.chosen.pack( side = LEFT, expand = YES, fill = BOTH,
padx = 5, pady = 5 )
def addColor( self ):
"""Insert each selected item into ScrolledText"""
self.chosen.clear() # clear contents of chosen
selected = self.listBox.getcurselection()
if selected:
for item in selected:
self.chosen.insert( END, item + "\n" )
def main():
colorNames = ( "cyan", "green", "grey", "magenta",
"orange", "pink", "red", "white", "yellow" )
ChoiceBox( colorNames ).mainloop()
if __name__ == "__main__":
main()
```

You might also like to view...
A generic method _______ be overloaded.
a) may b) may not c) must d) depends on the method’s functionality
To allow a user to make changes to a cell after a worksheet is protected, you must ________ the cell
Fill in the blank(s) with the appropriate word(s).
When a dynamic variable is no longer needed, it can be destroyed; that is, its memory can be deallocated.
Answer the following statement true (T) or false (F)
XenServer is a powerful hypervisor that serves as the foundation for massive cloud offerings.
Answer the following statement true (T) or false (F)