Пример #1
0
 def __init__(self, master=None, callback=None, **kwargs):
     """
     :param master: master widget
     :param callback: callable object with single argument: font family name
     :param kwargs: keyword arguments passed on to AutocompleteCombobox initializer
     """
     font_families = sorted([item for item in font.families()])
     self._fonts = font_families
     self._font = tk.StringVar(master)
     self.__callback = callback
     AutocompleteCombobox.__init__(self,
                                   master,
                                   textvariable=self._font,
                                   completevalues=font_families,
                                   **kwargs)
     self.bind("<<ComboboxSelected>>", self._on_select)
Пример #2
0
    def __init__(self, master=None, callback=None, **kwargs):
        """
        Create a FontFamilyDropdown.

        :param master: master widget
        :type master: widget
        :param callback: callable object with single argument: font family name
        :type callback: function
        :param kwargs: keyword arguments passed on to the :class:`~ttkwidgets.autocomplete.AutocompleteCombobox` initializer
        """
        font_families = sorted(set(font.families()))
        self._fonts = font_families
        self._font = tk.StringVar(master)
        self.__callback = callback
        AutocompleteCombobox.__init__(self, master, textvariable=self._font, completevalues=font_families, **kwargs)
        self.bind("<<ComboboxSelected>>", self._on_select)
        self.bind("<Return>", self._on_select)
Пример #3
0
 def __init__(self, master=None, callback=None, **kwargs):
     """
     :param master: master widget
     :param callback: callback on click with signle argument: int size
     :param kwargs: keyword arguments passed on to AutocompleteCombobox initializer
     """
     int_values = [
         8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72
     ]
     values = [str(value) for value in int_values]
     AutocompleteCombobox.__init__(self,
                                   master,
                                   completevalues=values,
                                   **kwargs)
     self.bind("<<ComboboxSelected>>", self._on_click)
     self.__callback = callback
     self.insert(0, "12")