Пример #1
0
        def __init__(self, **kwargs):
            super().__init__(**kwargs)
            self._isReady = True

            self.vsb = Scrollbar(self, orient="vertical")
            self.text = Text(self,
                             height=10,
                             yscrollcommand=self.vsb.set,
                             bg=self.master.cget('bg'),
                             wrap='word')
            self.vsb.config(command=self.text.yview)
            self.vsb.pack(side='right', fill='y')
            self.text.pack(side='left', fill='both', expand=True)

            # Create the list of checkboxes
            self._listOfTypes = []
            for currType in dsTypes.__all__:
                v = BooleanVar(value=1)
                cb = Checkbutton(self,
                                 text='%s' % currType,
                                 anchor=W,
                                 width=15,
                                 variable=v)
                cb.var = v  # Easy access to checkbox's current value

                e = Entry(self)
                e.delete(0, END)
                e.insert(0, '<suffix>.<file_extension>')

                self._listOfTypes.append((cb, e))
                self.text.window_create('end', window=cb)
                self.text.window_create('end', window=e)
                self.text.insert('end', '\n')  # Forces one checkbox per line

            # Insert help message
            self.text.insert('end', self.__doc__)

            # This MUST follow insertion and positioning of
            # the checkboxes/entries
            self.text.config(state=DISABLED)
Пример #2
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self._isReady = True
     
     self.vsb  = Scrollbar(self, orient="vertical")
     self.text = Text(
         self, height = 10,
         yscrollcommand=self.vsb.set,
         bg = self.master.cget('bg'),
         wrap = 'word')
     self.vsb.config(command=self.text.yview)
     self.vsb.pack(side='right', fill='y')
     self.text.pack(side='left', fill='both', expand=True)
     
     # Create the list of checkboxes
     self._listOfTypes = []
     for currType in dsTypes.__all__:
         v = BooleanVar(value = 1)
         cb = Checkbutton(self, text = '%s' % currType, anchor = W,
                          width = 15, variable = v)
         cb.var = v # Easy access to checkbox's current value
         
         e  = Entry(self)
         e.delete(0, END)
         e.insert(0, '<suffix>.<file_extension>')
         
         self._listOfTypes.append((cb, e))
         self.text.window_create('end', window=cb)
         self.text.window_create('end', window=e)
         self.text.insert('end', '\n') # Forces one checkbox per line
     
     # Insert help message
     self.text.insert('end', self.__doc__)
     
     # This MUST follow insertion and positioning of
     # the checkboxes/entries
     self.text.config(state = DISABLED)