Next / Previous / Contents / Shipman's homepage

6.2. FamilyPicker._listboxHandler()

This method is called whenever the user clicks in the family names list. When called, it calls the observer function and passes the font name to it.

fontselect.py
    def _listboxHandler(self, lineNo):
        """Handler for selection in the listbox.
        """

First we need to translate the line number in the list box into a family name. Then we pass that to our observer callback.

fontselect.py
        #-- 1 --
        # [ familyName  :=  text from the (lineNo)th line of
        #       self.scrollList ]
        familyName = self.scrollList[lineNo]

        #-- 2 --
        self.observer(familyName)