Python tkinter.Listbox() Examples

The following are 30 code examples of tkinter.Listbox(). 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: view.py    From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License 8 votes vote down vote up
def create_list_box(self):
        frame = tk.Frame(self.root)
        self.list_box = tk.Listbox(frame, activestyle='none', cursor='hand2',
                                   bg='#1C3D7D', fg='#A0B9E9', selectmode=tk.EXTENDED, height=10)
        self.list_box.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
        self.list_box.bind(
            "<Double-Button-1>", self.on_play_list_double_clicked)
        self.list_box.bind("<Button-3>", self.show_context_menu)
        scroll_bar = tk.Scrollbar(frame)
        scroll_bar.pack(side=tk.RIGHT, fill=tk.BOTH)
        self.list_box.config(yscrollcommand=scroll_bar.set)
        scroll_bar.config(command=self.list_box.yview)
        frame.grid(row=4, padx=5, columnspan=10, sticky='ew') 
Example #2
Source File: ResultView.py    From moviecatcher with MIT License 7 votes vote down vote up
def showRes (self) :
		self.resWindow = tkinter.Toplevel()
		self.resWindow.title(self.target['title'])
		self.resWindow.resizable(width = 'false', height = 'false')
		if self.Tools.isWin() :
			self.resWindow.iconbitmap(self.Tools.getRes('biticon.ico'))
		self.resWindow.config(background='#444')

		self.resFrame = tkinter.Frame(self.resWindow, bd = 0, bg="#444")
		self.resFrame.grid(row = 0, column = 0, sticky = '')

		btnZone = tkinter.Frame(self.resWindow, bd = 10, bg="#444")
		btnZone.grid(row = 1, column = 0, sticky = '')

		self.resList = tkinter.Listbox(self.resFrame, height = 8, width = 50, bd = 0, bg="#222", fg = '#ddd',selectbackground = '#116cd6', highlightthickness = 0)
		self.resList.grid(row = 0, sticky = '')

		viewBtn = tkinter.Button(btnZone, text = '查看连接', width = 10, fg = '#222', highlightbackground = '#444', command = self.__taskShow)
		viewBtn.grid(row = 0, column = 0, padx = 5)

		watchBtn = tkinter.Button(btnZone, text = '在线观看', width = 10, fg = '#222', highlightbackground = '#444', command = self.__taskWatch)
		watchBtn.grid(row = 0, column = 1, padx = 5)

		dlBtn = tkinter.Button(btnZone, text = '离线下载', width = 10, fg = '#222', highlightbackground = '#444', command = self.__taskDownload)
		dlBtn.grid(row = 0, column = 2, padx = 5) 
Example #3
Source File: view.py    From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License 6 votes vote down vote up
def create_list_box(self):
        frame = tk.Frame(self.root)
        self.list_box = tk.Listbox(frame, activestyle='none', cursor='hand2',
                                   bg='#1C3D7D', fg='#A0B9E9', selectmode=tk.EXTENDED, height=10)
        self.list_box.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
        self.list_box.bind(
            "<Double-Button-1>", self.on_play_list_double_clicked)
        self.list_box.bind("<Button-3>", self.show_context_menu)
        scroll_bar = tk.Scrollbar(frame)
        scroll_bar.pack(side=tk.RIGHT, fill=tk.BOTH)
        self.list_box.config(yscrollcommand=scroll_bar.set)
        scroll_bar.config(command=self.list_box.yview)
        frame.grid(row=4, padx=5, columnspan=10, sticky='ew') 
Example #4
Source File: components.py    From SEM with MIT License 6 votes vote down vote up
def __init__(self, root, main_window, button_opt):
        ttk.Frame.__init__(self, root)
        
        self.root = root
        self.main_window = main_window
        self.current_files = None
        self.button_opt = button_opt
        
        # define options for opening or saving a file
        self.file_opt = options = {}
        options['defaultextension'] = '.txt'
        options['filetypes'] = [('all files', '.*'), ('text files', '.txt')]
        options['initialdir'] = os.path.expanduser("~")
        options['parent'] = root
        options['title'] = 'Select files to annotate.'
        
        self.file_selector_button = ttk.Button(self.root, text=u"select file(s)", command=self.filenames)
        self.label = ttk.Label(self.root, text=u"selected file(s):")
        self.fa_search = tkinter.PhotoImage(file=os.path.join(self.main_window.resource_dir, "images", "fa_search_24_24.gif"))
        self.file_selector_button.config(image=self.fa_search, compound=tkinter.LEFT)
        
        self.scrollbar = ttk.Scrollbar(self.root)
        self.selected_files = tkinter.Listbox(self.root, yscrollcommand=self.scrollbar.set)
        self.scrollbar.config(command=self.selected_files.yview) 
Example #5
Source File: test_widgets.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def create(self, **kwargs):
        return tkinter.Listbox(self.root, **kwargs) 
Example #6
Source File: view.py    From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License 5 votes vote down vote up
def create_list_box(self):
        frame = tk.Frame(self.root)
        self.list_box = tk.Listbox(frame, activestyle='none', cursor='hand2',
                                   bg='#1C3D7D', fg='#A0B9E9', selectmode=tk.EXTENDED, height=10)
        self.list_box.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
        self.list_box.bind(
            "<Double-Button-1>", self.on_play_list_double_clicked)
        self.list_box.bind("<Button-3>", self.show_context_menu)
        scroll_bar = tk.Scrollbar(frame)
        scroll_bar.pack(side=tk.RIGHT, fill=tk.BOTH)
        self.list_box.config(yscrollcommand=scroll_bar.set)
        scroll_bar.config(command=self.list_box.yview)
        frame.grid(row=4, padx=5, columnspan=10, sticky='ew') 
Example #7
Source File: view.py    From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License 5 votes vote down vote up
def create_list_box(self):
        frame = tk.Frame(self.root)
        self.list_box = tk.Listbox(frame, activestyle='none', cursor='hand2',
                                   bg='#1C3D7D', fg='#A0B9E9', selectmode=tk.EXTENDED, height=10)
        self.list_box.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
        self.list_box.bind(
            "<Double-Button-1>", self.on_play_list_double_clicked)
        self.list_box.bind("<Button-3>", self.show_context_menu)
        scroll_bar = tk.Scrollbar(frame)
        scroll_bar.pack(side=tk.RIGHT, fill=tk.BOTH)
        self.list_box.config(yscrollcommand=scroll_bar.set)
        scroll_bar.config(command=self.list_box.yview)
        frame.grid(row=4, padx=5, columnspan=10, sticky='ew') 
Example #8
Source File: test_widgets.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def create(self, **kwargs):
        return tkinter.Listbox(self.root, **kwargs) 
Example #9
Source File: tooltip.py    From snn_toolbox with MIT License 5 votes vote down vote up
def demo():
    root = tk.Tk(className='ToolTip-demo')
    l = tk.Listbox(root)
    l.insert('end', "I'm a listbox")
    l.pack(side='top')
    ToolTip(l, follow_mouse=1, text="I'm a tooltip with follow_mouse set to 1, so I won't be placed outside my parent")
    b = tk.Button(root, text='Quit', command=root.quit)
    b.pack(side='bottom')
    ToolTip(b, text='Enough of this')
    root.mainloop() 
Example #10
Source File: app.py    From captcha_trainer with Apache License 2.0 5 votes vote down vote up
def listbox_scrollbar(listbox: tk.Listbox):
        y_scrollbar = tk.Scrollbar(
            listbox, command=listbox.yview
        )
        y_scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
        listbox.config(yscrollcommand=y_scrollbar.set) 
Example #11
Source File: app.py    From captcha_trainer with Apache License 2.0 5 votes vote down vote up
def listbox_delete_item_callback(self, event, listbox: tk.Listbox):
        i = listbox.curselection()[0]
        listbox.delete(i)
        self.save_conf() 
Example #12
Source File: ListBox.py    From guizero with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, master, items=None, selected=None, command=None, grid=None, align=None, visible=True, enabled=None, multiselect=False, width=None, height=None):

        description = "[ListBox] object"
        self._multiselect = multiselect

        # Create a tk OptionMenu object within this object
        mode = EXTENDED if multiselect else BROWSE
        # exportselection=0 allows you to select from more than 1 Listbox
        tk = Listbox(master.tk, selectmode=mode, exportselection=0)

        # Add the items
        if items is not None:
            for item in items:
                tk.insert(END, item)

        super(ListBoxWidget, self).__init__(master, tk, description, grid, align, visible, enabled, width, height)

        self.events.set_event("<ListBox.ListboxSelect>", "<<ListboxSelect>>", self._command_callback)

        # Select the selected items
        if selected is not None:
            self.value = selected

        # The command associated with this combo
        self.update_command(command) 
Example #13
Source File: ListPanel.py    From Python-Media-Player with Apache License 2.0 5 votes vote down vote up
def create_song_list_panel(self):
        # Creating Picture Canvas as Background
        background=Tkinter.PhotoImage(file="../Icons/background.gif")
        mainframe=Tkinter.Canvas(self.root)
        mainframe.pack(side='top', expand='yes', fill='both')
        mainframe.image=background
        mainframe.create_image(0, 0, anchor="nw", image=background)
        
        frame0=Tkinter.Frame(mainframe)
        frame0.pack(side='top')
        Tkinter.Label(frame0, text='Search : ', bg='skyblue').pack(side='left', expand='yes', fill='x')
        Tkinter.Entry(frame0, textvariable=self.var1).pack(side='left', expand='yes', fill='x')
        frame0.bind_all('<Any-KeyPress>',self.search_song_trigger)
        frame=Tkinter.Frame(mainframe, bg='skyblue')
        frame.pack(side='top')
        self.list_box=Tkinter.Listbox(frame, bg='powderblue', font=list_box_song_list_font, width=list_box_width, height=list_box_height)
        scrollbar=Tkinter.Scrollbar(frame, bg='skyblue')
        scrollbar.pack(side='right',expand='yes',fill='y')
        scrollbar.config(command=self.list_box.yview)
        self.list_box.config(yscrollcommand=scrollbar.set)
        self.list_box.pack(expand='yes',fill='both',side='right')
        frame1=Tkinter.Frame(mainframe, bg='blue')
        frame1.pack(side='top', expand='yes',fill='x')
        add_fileicon=Tkinter.PhotoImage(file="../Icons/add_file.gif")
        add_directoryicon=Tkinter.PhotoImage(file="../Icons/add_directory.gif")
        list_file=[
        (add_fileicon,'self.ask_for_play_song_direct'),
        (add_directoryicon,'self.ask_for_directory'),
        ]
        for i,j in list_file:
                storeobj=Tkinter.Button(frame1, image=i, command=eval(j), bg='blue')
                storeobj.pack(side='left')
                storeobj.image=i
        self.list_box.bind('<Double-Button-1>',self.play_on_click)
        return self.update_list_box_songs() 
Example #14
Source File: dataset_frame.py    From OpenCV-Video-Label with GNU General Public License v3.0 5 votes vote down vote up
def reset_frames(self, update_current_class=True):
        self.dataset = self.parent.dataset
        self.clear(self.frame_list)
        self.canvas.yview_moveto(0)

        # if tab switching or image has been deleted and class is now empty
        if update_current_class or self.current_class not in self.dataset.classes:
            self.current_class = self.parent.current_object

        # initialise delete button if not yet done
        if not self.delete_button and self.current_class:
            self.delete_button = tk.Button(self.settings_frame, EDIT_BUTTON_LAYOUT, text='Delete selected images',
                                           command=self.delete_selected)
            self.delete_button.pack(side="top", fill="x", pady=10, padx=20)
            self.export_button = tk.Button(self.settings_frame, EDIT_BUTTON_LAYOUT, text='Export dataset',
                                           command=self.export_dataset_thread)
            self.export_button.pack(side="bottom", fill="x", pady=10, padx=40)

            spacing = tk.Frame(self.settings_frame, bg=GUI_SHADOW, height=1)
            spacing.pack(side="bottom", fill="x", padx=10)

            self.export_selection = tk.Listbox(self.settings_frame, selectmode=tk.BROWSE)
            self.export_selection.configure(relief="flat", cursor="hand2", takefocus=0, activestyle='none', bd=0,
                                            height=3,
                                            highlightcolor=GUI_BG, highlightbackground=GUI_BG,
                                            font=("Arial", 11, "bold"),
                                            selectbackground=GUI_SHADOW, fg=GUI_GRAYD, listvariable=0,
                                            selectforeground=GUI_GRAYD,
                                            exportselection=False)
            self.export_selection.bind('<<ListboxSelect>>', self.update_export_selection)
            self.export_selection.insert(0, "     Cropped images")
            self.export_selection.insert(1, "     Pascal VOC (xml)")
            self.export_selection.insert(2, "     Single csv file")
            self.export_selection.select_set(0)
            self.export_selection.pack(side="bottom", fill="x", pady=5, padx=40)

            # option menu to select how the data will be exported:
            tk.Label(self.settings_frame, bg=GUI_BG, fg=GUI_GRAYD, font="Arial 10 bold",
                     text="Export format:").pack(side="bottom", fill="x", padx=40) 
Example #15
Source File: fontchooser.py    From Tkinter-GUI-Programming-by-Example with MIT License 5 votes vote down vote up
def __init__(self, master, **kwargs):
        super().__init__(**kwargs)
        self.master = master

        self.transient(self.master)
        self.geometry('500x250')
        self.title('Choose font and size')

        self.configure(bg=self.master.background)

        self.font_list = tk.Listbox(self, exportselection=False)

        self.available_fonts = sorted(families())

        for family in self.available_fonts:
            self.font_list.insert(tk.END, family)

        current_selection_index = self.available_fonts.index(self.master.font_family)
        if current_selection_index:
            self.font_list.select_set(current_selection_index)
            self.font_list.see(current_selection_index)

        self.size_input = tk.Spinbox(self, from_=0, to=99, value=self.master.font_size)

        self.save_button = ttk.Button(self, text="Save", style="editor.TButton", command=self.save)

        self.save_button.pack(side=tk.BOTTOM, fill=tk.X, expand=1, padx=40)
        self.font_list.pack(side=tk.LEFT, fill=tk.Y, expand=1)
        self.size_input.pack(side=tk.BOTTOM, fill=tk.X, expand=1) 
Example #16
Source File: ui_utils.py    From thonny with MIT License 5 votes vote down vote up
def get_style_name(self):
        return "Listbox" 
Example #17
Source File: running.py    From thonny with MIT License 5 votes vote down vote up
def _cmd_interrupt_with_shortcut(self, event=None):
        if not self._cmd_interrupt_enabled():
            return

        if not running_on_mac_os():  # on Mac Ctrl+C is not used for Copy.
            # Disable Ctrl+C interrupt in editor and shell, when some text is selected
            # (assuming user intended to copy instead of interrupting)
            widget = get_workbench().focus_get()
            if isinstance(widget, tk.Text):
                if len(widget.tag_ranges("sel")) > 0:
                    # this test is reliable, unlike selection_get below
                    return
            elif isinstance(widget, (tk.Listbox, ttk.Entry, tk.Entry, tk.Spinbox)):
                try:
                    selection = widget.selection_get()
                    if isinstance(selection, str) and len(selection) > 0:
                        # Assuming user meant to copy, not interrupt
                        # (IDLE seems to follow same logic)

                        # NB! This is not perfect, as in Linux the selection can be in another app
                        # ie. there may be no selection in Thonny actually.
                        # In other words, Ctrl+C interrupt may be dropped without reason
                        # when given inside the widgets listed above.
                        return
                except Exception:
                    # widget either doesn't have selection_get or it
                    # gave error (can happen without selection on Ubuntu)
                    pass

        self._cmd_interrupt()
        return "break" 
Example #18
Source File: autocomplete.py    From thonny with MIT License 5 votes vote down vote up
def __init__(self, text):
        tk.Listbox.__init__(
            self, master=text, font="SmallEditorFont", activestyle="dotbox", exportselection=False
        )

        self.text = text
        self.completions = []

        self.doc_label = tk.Label(
            master=text, text="Aaappiiiii", bg="#ffffe0", justify="left", anchor="nw"
        )

        # Auto indenter will eat up returns, therefore I need to raise the priority
        # of this binding
        self.text_priority_bindtag = "completable" + str(self.text.winfo_id())
        self.text.bindtags((self.text_priority_bindtag,) + self.text.bindtags())
        self.text.bind_class(self.text_priority_bindtag, "<Key>", self._on_text_keypress, True)

        self.text.bind("<<TextChange>>", self._on_text_change, True)  # Assuming TweakableText

        # for cases when Listbox gets focus
        self.bind("<Escape>", self._close)
        self.bind("<Return>", self._insert_current_selection)
        self.bind("<Double-Button-1>", self._insert_current_selection)
        self._bind_result_event() 
Example #19
Source File: contacts_view.py    From Tkinter-GUI-Application-Development-Cookbook with MIT License 5 votes vote down vote up
def __init__(self, master, **kwargs):
        super().__init__(master)
        self.lb = tk.Listbox(self, **kwargs)
        scroll = tk.Scrollbar(self, command=self.lb.yview)

        self.lb.config(yscrollcommand=scroll.set)
        scroll.pack(side=tk.RIGHT, fill=tk.Y)
        self.lb.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) 
Example #20
Source File: chapter5_02.py    From Tkinter-GUI-Application-Development-Cookbook with MIT License 5 votes vote down vote up
def __init__(self, master, **kwargs):
        super().__init__(master)
        self.lb = tk.Listbox(self, **kwargs)
        scroll = tk.Scrollbar(self, command=self.lb.yview)

        self.lb.config(yscrollcommand=scroll.set)
        scroll.pack(side=tk.RIGHT, fill=tk.Y)
        self.lb.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) 
Example #21
Source File: chapter1_09.py    From Tkinter-GUI-Application-Development-Cookbook with MIT License 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.list = tk.Listbox(self) 
        self.list.insert(0, *DAYS)
        self.print_btn = tk.Button(self, text="Print selection",
                                   command=self.print_selection)
        self.btns = [self.create_btn(m) for m in MODES]

        self.list.pack()
        self.print_btn.pack(fill=tk.BOTH)
        for btn in self.btns:
            btn.pack(side=tk.LEFT) 
Example #22
Source File: chapter2_01.py    From Tkinter-GUI-Application-Development-Cookbook with MIT License 5 votes vote down vote up
def __init__(self, master, items=[]):
        super().__init__(master) 
        self.list = tk.Listbox(self)
        self.scroll = tk.Scrollbar(self, orient=tk.VERTICAL,
                                   command=self.list.yview)
        self.list.config(yscrollcommand=self.scroll.set)
        self.list.insert(0, *items)
        self.list.pack(side=tk.LEFT)
        self.scroll.pack(side=tk.LEFT, fill=tk.Y) 
Example #23
Source File: 011根据ip查询地理位置.py    From PythonGUIDemo with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        self.gi = pygeoip.GeoIP("./GeoLiteCity.dat")
        # 创建主窗口,用于容纳其它组件
        self.root = tkinter.Tk()
        # 给主窗口设置标题内容
        self.root.title("全球定位ip位置(离线版)")
        # 创建一个输入框,并设置尺寸
        self.ip_input = tkinter.Entry(self.root,width=30)

        # 创建一个回显列表
        self.display_info = tkinter.Listbox(self.root, width=50)

        # 创建一个查询结果的按钮
        self.result_button = tkinter.Button(self.root, command = self.find_position, text = "查询")

    # 完成布局 
Example #24
Source File: widgets.py    From tk_tools with MIT License 5 votes vote down vote up
def __init__(self, parent, options: List[str],
                 width: int = 12, height: int = 5,
                 on_select_callback: callable = None,
                 selectmode: str = 'browse'):
        super().__init__(parent=parent)

        self._on_select_callback = on_select_callback
        self._values = {}

        r = 0
        self._lb = tk.Listbox(self, width=width, height=height,
                              selectmode=selectmode, exportselection=0)
        self._lb.grid(row=r, column=0, sticky='ew')
        [self._lb.insert('end', option) for option in options]
        self._lb.bind('<<ListboxSelect>>', lambda _: self._on_select())

        r += 1
        clear_label = tk.Label(self, text='clear', fg='blue')
        clear_label.grid(row=r, column=0, sticky='ew')
        clear_label.bind('<Button-1>', lambda _: self._clear_selected()) 
Example #25
Source File: gui_04.py    From Modern-Python-Standard-Library-Cookbook with MIT License 5 votes vote down vote up
def body(self, parent):
        self._message = tkinter.Message(parent, text=self._text, aspect=400)
        self._message.pack(expand=1, fill=tkinter.BOTH)
        self._list = tkinter.Listbox(parent)
        self._list.pack(expand=1, fill=tkinter.BOTH, side=tkinter.TOP)
        for item in self._items:
            self._list.insert(tkinter.END, item)
        return self._list 
Example #26
Source File: fontchooser.py    From Tkinter-GUI-Programming-by-Example with MIT License 5 votes vote down vote up
def __init__(self, master, **kwargs):
        super().__init__(**kwargs)
        self.master = master

        self.transient(self.master)
        self.geometry('500x250')
        self.title('Choose font and size')

        self.configure(bg=self.master.background)

        self.font_list = tk.Listbox(self, exportselection=False)

        self.available_fonts = sorted(families())

        for family in self.available_fonts:
            self.font_list.insert(tk.END, family)

        current_selection_index = self.available_fonts.index(self.master.font_family)
        if current_selection_index:
            self.font_list.select_set(current_selection_index)
            self.font_list.see(current_selection_index)

        self.size_input = tk.Spinbox(self, from_=0, to=99, value=self.master.font_size)

        self.save_button = ttk.Button(self, text="Save", style="editor.TButton", command=self.save)

        self.save_button.pack(side=tk.BOTTOM, fill=tk.X, expand=1, padx=40)
        self.font_list.pack(side=tk.LEFT, fill=tk.Y, expand=1)
        self.size_input.pack(side=tk.BOTTOM, fill=tk.X, expand=1) 
Example #27
Source File: components.py    From SEM with MIT License 5 votes vote down vote up
def __init__(self, root, resource_dir, lang="fr"):
        ttk.Frame.__init__(self, root)
        
        self.resource_dir = resource_dir
        self._lang = None
        langs = os.listdir(os.path.join(self.resource_dir, "master"))
        if langs:
            self._lang = (lang if lang in langs else langs[0])
        
        self.items = (os.listdir(os.path.join(self.resource_dir, "master", self._lang)) if self._lang else [])
        self.items.sort(key=lambda x: x.lower())
        max_length = max([len(item) for item in self.items])
        
        self.select_workflow_label = ttk.Label(root, text=u"select workflow:")
        #strVar = tkinter.StringVar()
        self.masters = tkinter.Listbox(root, width=max_length+1, height=len(self.items))#, textvariable=strVar)

        for item in self.items:
            self.masters.insert(tkinter.END, item) 
Example #28
Source File: ChessView.py    From cchess-zero with MIT License 5 votes vote down vote up
def __init__(self, control, board):
        self.control = control
        if self.control.game_mode != 2:
            self.can.bind('<Button-1>', self.control.callback)

        self.lb = tkinter.Listbox(ChessView.root,selectmode="browse")
        self.scr1 = tkinter.Scrollbar(ChessView.root)
        self.lb.configure(yscrollcommand=self.scr1.set)
        self.scr1['command'] = self.lb.yview
        self.scr1.pack(side='right',fill="y")
        self.lb.pack(fill="x")

        self.lb.bind('<<ListboxSelect>>', self.printList)  # Double-    <Button-1>
        self.board = board
        self.last_text_x = 0
        self.last_text_y = 0
        self.print_text_flag = False

    # def start(self):
    #     tkinter.mainloop() 
Example #29
Source File: Downloader.py    From proyectoDownloader with MIT License 5 votes vote down vote up
def iniciaTabPL(self):
        ttk.Label(self.tabPL, text="Videos disponibles: ", 
          font=("Arial", 14)).place(x=5,y=10)
        self.listPL = Listbox(self.tabPL, height=10, width=66,
                               font=("Arial", 14), bg='#ABAAAA')
        scrollbar = ttk.Scrollbar(self.tabPL, 
                  command=self.listPL.yview, orient=VERTICAL)
        self.listPL.config(yscrollcommand=scrollbar.set)
        self.listPL.config(selectforeground="#eeeeee",
                            selectbackground="#89C2DE",
                            selectborderwidth=1)
        self.listPL.place(x=6,y=50)
        scrollbar.place(x=723,y=50, height=254)
        self.plbvideo = ttk.Button(self.tabPL, text="Ir a descargar video",
                             command = self.controlador.cargarInfoDesdePL)
        self.plbvideo.place(x=30, y=320)
        
        self.plbbvideo = ttk.Button(self.tabPL, text="Descargar playlist video")
        self.plbbvideo.place(x=250, y=320)

        self.plbbaudio = ttk.Button(self.tabPL, text="Descargar playlist audio")
        self.plbbaudio.place(x=500, y=320) 
Example #30
Source File: scrolledlistbox.py    From ttkwidgets with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, master=None, compound=tk.RIGHT, autohidescrollbar=True, **kwargs):
        """
        Create a Listbox with a vertical scrollbar.

        :param master: master widget
        :type master: widget
        :param compound: side for the Scrollbar to be on (:obj:`tk.LEFT` or :obj:`tk.RIGHT`)
        :type compound: str
        :param autohidescrollbar: whether to use an :class:`~ttkwidgets.AutoHideScrollbar` or a :class:`ttk.Scrollbar`
        :type autohidescrollbar: bool
        :param kwargs: keyword arguments passed on to the :class:`tk.Listbox` initializer
        """
        ttk.Frame.__init__(self, master)
        self.columnconfigure(1, weight=1)
        self.rowconfigure(0, weight=1)
        self.listbox = tk.Listbox(self, **kwargs)
        if autohidescrollbar:
            self.scrollbar = AutoHideScrollbar(self, orient=tk.VERTICAL, command=self.listbox.yview)
        else:
            self.scrollbar = ttk.Scrollbar(self, orient=tk.VERTICAL, command=self.listbox.yview)
        self.config_listbox(yscrollcommand=self.scrollbar.set)
        if compound is not tk.LEFT and compound is not tk.RIGHT:
            raise ValueError("Invalid compound value passed: {0}".format(compound))
        self.__compound = compound
        self._grid_widgets()