Python tkinter.SINGLE Examples

The following are 3 code examples of tkinter.SINGLE(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tkinter , or try the search function .
Example #1
Source File: detailSettingsFrame.py    From PyEveLiveDPS with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, master, **kw):
        kw['selectmode'] = tk.SINGLE
        kw['activestyle'] = 'none'
        kw['height'] = '0'
        tk.Listbox.__init__(self, master, kw)
        self.bind('<Button-1>', self.setCurrent)
        self.bind('<B1-Motion>', self.shiftSelection)
        self.curIndex = None 
Example #2
Source File: workflowcreator.py    From CEASIOMpy with Apache License 2.0 4 votes vote down vote up
def __init__(self, master, name, **kwargs):

        tk.Frame.__init__(self, master, **kwargs)

        self.name = name

        # Get list of available modules
        self.modules_list = mi.get_submodule_list()
        self.modules_list.sort()

        self.modules_list.remove('SettingsGUI')
        self.modules_list.insert(0,'SettingsGUI')

        self.modules_list.remove('CPACSUpdater')
        self.modules_list.remove('WorkflowCreator')
        self.modules_list.remove('utils')
        try:
            self.modules_list.remove('WKDIR')
        except:
            log.info('No WKDIR yet.')

        self.selected_list = []

        row_pos = 0

        if name == 'Optim':

            label_optim = tk.Label(self, text='Optimisation method')
            label_optim.grid(column=0, row=0, columnspan=1,pady=10)

            # The Combobox is directly use as the varaible
            optim_choice = ['None', 'DoE', 'Optim']
            self.optim_choice_CB = ttk.Combobox(self, values=optim_choice, width=15)
            self.optim_choice_CB.grid(column=4, row=row_pos)
            row_pos += 1

        # ListBox with all available modules
        tk.Label(self, text='Available modules').grid(column=0, row=row_pos, pady=5)
        self.LB_modules = tk.Listbox(self, selectmode=tk.SINGLE, width=25, height=len(self.modules_list))
        item_count = len(self.modules_list)
        self.LB_modules.grid(column=0, row=row_pos+1, columnspan=3, rowspan=15, padx=10, pady=3)
        for item in self.modules_list:
            self.LB_modules.insert(tk.END, item)

        # Button
        addButton = tk.Button(self, text='   Add >   ', command=self._add)
        addButton.grid(column=4, row=row_pos+1)
        removeButton = tk.Button(self, text='< Remove', command=self._remove)
        removeButton.grid(column=4, row=row_pos+2)
        upButton = tk.Button(self, text='    Up  ^   ', command=self._up)
        upButton.grid(column=4, row=row_pos+3)
        downButton = tk.Button(self, text='  Down v  ', command=self._down)
        downButton.grid(column=4, row=row_pos+4)

        # ListBox with all selected modules
        tk.Label(self, text='Selected modules').grid(column=5, row=row_pos)
        self.LB_selected = tk.Listbox(self, selectmode=tk.SINGLE, width=25, height=len(self.modules_list))
        self.LB_selected.grid(column=5, row=row_pos+1, columnspan=3, rowspan=15, padx=10, pady=3)
        for item in self.selected_list:
            self.LB_selected.insert(tk.END, item)
            row_pos += (item_count + 1) 
Example #3
Source File: ankimaker.py    From ankimaker with MIT License 4 votes vote down vote up
def init_gui(self):
        """Builds GUI."""
        self.root.title('AnkiMaker')     
        self.grid(column=0, row=0, sticky='nsew')
        
        lists_width = 10
        
        
        # Loaders frame              
              
        loader_list = [loaders.KindleLoader,
                       loaders.FileLoader,
                       loaders.OEDLoader,
                       loaders.WikLoader]
        
        self.loaders = []
        for l in loader_list:
            # initialize every loader's frame with the mainframe as parent
            self.loaders.append(l(self))
        
        # Loaders list
        
        self.list = tkinter.Listbox(self, width = lists_width, 
                                    height = 8,
                                    selectmode = tkinter.SINGLE)
        self.list.grid(column=0, row=0, sticky = 'N')
        for op in self.loaders:
            self.list.insert(tkinter.END, op.name)   
        self.list.bind('<<ListboxSelect>>', self.select)
        

        self.list.selection_set(0)      

        # Deck creation frame
        
        self.dframe = DeckFrame(self)
        self.dframe.grid(column=0, row=1, columnspan = 4)
        self.dframe.disable()
        
        # Add padding to everything
        for child in self.winfo_children():
            child.grid_configure(padx=5, pady=5)
                                            
        self.select()