Creating a multiple selection list. : ListBox : Tkinker PYTHON TUTORIALS


PYTHON TUTORIALS » Tkinker » ListBox »

 

Creating a multiple selection list.


Creating a multiple selection list.
from Tkinter import *
import Pmw

class choiceBoxFrame ):
   def __init__self, listItems ):
      Frame.__init__self )
      self.packexpand = YES, fill = BOTH )
      self.master.title"Select" )

      self.listBox = Pmw.ScrolledListBoxself,
                                          items = listItems,
                                          listbox_height = 5,
                                          vscrollmode = "static",
                                          listbox_selectmode = EXTENDED )
      self.listBox.packside = LEFT, expand = YES, fill = BOTH,padx = 5, pady = )

      self.copyButton = Buttonself,text = ">>>", command = self.addColor )
      self.copyButton.packside = LEFT, padx = 5, pady = )

      self.chosen = Pmw.ScrolledTextself,text_height = 6,text_width = 20 )
      self.chosen.packside = LEFT, expand = YES, fill = BOTH,padx = 5, pady = )

   def addColorself ):
      self.chosen.clear()
      selected = self.listBox.getcurselection()

      if selected:
         for item in selected:
            self.chosen.insertEND, item + "n" )

colorNames = "A""B""C""D")
choiceBoxcolorNames ).mainloop()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Tkinker
» ListBox