Python tkinter.ttk.Separator() Examples

The following are 16 code examples of tkinter.ttk.Separator(). 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.ttk , or try the search function .
Example #1
Source File: Preferences.py    From python-in-practice with GNU General Public License v3.0 5 votes vote down vote up
def layout_general_widgets(self, master):
        pad = dict(padx=PAD, pady=PAD)
        self.shapeLabel.grid(row=0, column=0, sticky=tk.W, **pad)
        self.shapeCombobox.grid(row=0, column=1, sticky=tk.W, columnspan=4,
                **pad)
        ttk.Separator(master).grid(row=1, column=0, columnspan=99,
                sticky=(tk.W, tk.E))
        self.columnsLabel.grid(row=2, column=0, sticky=tk.W, **pad)
        self.columnsSpinbox.grid(row=2, column=1, sticky=tk.W, **pad)
        self.rowsLabel.grid(row=2, column=3, sticky=tk.E, **pad)
        self.rowsSpinbox.grid(row=2, column=4, sticky=tk.E, **pad)
        self.maxColorsLabel.grid(row=3, column=0, sticky=tk.W, **pad)
        self.maxColorsSpinbox.grid(row=3, column=1, sticky=tk.W, **pad) 
Example #2
Source File: __init__.py    From python-in-practice with GNU General Public License v3.0 5 votes vote down vote up
def add_toolbar_buttons(toolbar, buttons):
    """Adds the buttons to the toolbar; adds Separators for Nones"""
    for i, button in enumerate(buttons):
        if button is None:
            button = ttk.Separator(toolbar)
        else:
            button.config(takefocus=False)
            if isinstance(button, ttk.Button):
                button.config(style="Toolbutton")
        button.pack(side=tk.LEFT, padx=(0 if i == 0 else 2), pady=2) 
Example #3
Source File: Dock.py    From python-in-practice with GNU General Public License v3.0 5 votes vote down vote up
def __create_layout(self):
        pad = dict(padx=PAD, pady=PAD)
        padW = dict(sticky=tk.W, **pad)
        padWE = dict(sticky=(tk.W, tk.E), **pad)
        self.dockLeftButton.grid(row=0, column=0, sticky=tk.W)
        self.dockRightButton.grid(row=0, column=1, sticky=tk.W)
        ttk.Separator(self.dockFrame).grid(row=0, column=2)
        self.dockLabel.grid(row=0, column=3, sticky=(tk.W, tk.E))
        ttk.Separator(self.dockFrame).grid(row=0, column=4)
        self.undockButton.grid(row=0, column=5, sticky=tk.E)
        self.hideButton.grid(row=0, column=6, sticky=tk.E)
        self.dockFrame.grid(row=0, column=0, columnspan=99, **padWE)
        self.dockFrame.grid_columnconfigure(3, weight=1)
        self.grid_columnconfigure(0, weight=1)
        self.create_layout() 
Example #4
Source File: progress_tab.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, **kwargs):
        super().__init__(parent, **kwargs)
        self.grid_columnconfigure(1, weight=1)
        ttk.Separator(self).grid(row=0, column=0, columnspan=5, sticky="nswe", padx=2, pady=5)
        self.item_editors = item, addon1, addon2 = ItemEditor(self)
        
        # prevent frame from 
        tk.Label(self, width=2, font=ItemEditor.font).grid(row=2, column=0, sticky="nswe", padx=2)
        item.grid(row=1, column=0, isaddon=False)
        addon1.grid(row=2, column=0)
        addon2.grid(row=3, column=0)
        self.is_gridded = True 
Example #5
Source File: options.py    From hwk-mirror with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, master, ticket, **kwargs):
        super().__init__(master, **kwargs)
        self.editors = []
        last_sep = None  
        generator = (ticket for ticket in (ticket, ticket.addon1, ticket.addon2) if ticket.name)
        bt_frame = tk.Frame(self, bd=2, relief=tk.GROOVE, padx=10)
        bt_frame.grid(row=1, column=0, columnspan=6, sticky="nswe")
        bt_frame.grid_columnconfigure(1, weight=1)
        for i, item in enumerate(generator):
            if item.options:
                self.grid_columnconfigure(i * 2, weight=1)
                editor = EditOptionsFrame(self, item)
                editor.grid(row=0, column=(i * 2), sticky="nswe")
                self.editors.append(editor)
                last_sep = ttk.Separator(self, orient=tk.VERTICAL)
                last_sep.grid(row=0, column=(i * 2) + 1, sticky="ns")
        if last_sep is not None:
            last_sep.grid_remove()
        
        done = tk.Button(bt_frame, text="Done", width=8, bg="green", command=self.destroy)
        close = tk.Button(bt_frame, text="Close", width=8, bg="red", command=super().destroy) # doesn't save
        done.grid(row=0, column=2, pady=10, padx=5, sticky="nse")
        close.grid(row=0, column=1, pady=10, padx=5, sticky="nse") 
Example #6
Source File: categories_checkbox_gui.py    From pyDEA with MIT License 5 votes vote down vote up
def create_widgets(self):
        ''' Creates widgets of this object.
        '''
        yScrollbar = Scrollbar(self, orient=VERTICAL)
        yScrollbar.grid(row=2, column=3, sticky=N+S)

        canvas = StyledCanvas(self, height=HEIGHT_WITHOUT_CHECKBOXES,
                              yscrollcommand=yScrollbar.set)
        self.canvas = canvas
        canvas.grid(row=2, column=0, columnspan=3, sticky=N+E+W)

        self._config_columns(self)
        canvas.columnconfigure(0, weight=1)

        if self.add_headers:
            non_discr_lbl = Label(self, text='Non-\ndiscretionary')
            non_discr_lbl.grid(row=0, column=1, padx=3, pady=1)
            weakly_disp_lbl = Label(self, text='Weakly\ndisposable')
            weakly_disp_lbl.grid(row=0, column=2, padx=3, pady=1)
            sep = Separator(self)
            sep.grid(row=1, column=0, columnspan=3, sticky=E+W, pady=10, padx=3)

        self.frame_with_boxes = Frame(canvas)
        self._config_columns(self.frame_with_boxes)
        self.frame_with_boxes.grid(sticky=N+S+W+E, pady=15, padx=3)

        canvas.create_window(0, 0, window=self.frame_with_boxes, anchor=N+W)
        canvas.update_idletasks()

        canvas['scrollregion'] = (0, 0, 0, HEIGHT_WITHOUT_CHECKBOXES)
        yScrollbar['command'] = canvas.yview

        MouseWheel(self).add_scrolling(canvas, yscrollbar=yScrollbar) 
Example #7
Source File: test_widgets.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def create(self, **kwargs):
        return ttk.Separator(self.root, **kwargs) 
Example #8
Source File: 3.12.py    From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License 5 votes vote down vote up
def create_play_bar(self):
        playbar_frame = Frame(self.root, height=15)
        start_row = MAX_NUMBER_OF_DRUM_SAMPLES + 10
        playbar_frame.grid(row=start_row, columnspan=13,
                           sticky=W + E, padx=15, pady=10)
        self.play_icon = PhotoImage(file="images/play.gif")
        self.play_button = ttk.Button(
            playbar_frame, text='Play',  image=self.play_icon, compound='left', command=self.on_play_button_clicked)
        self.play_button.grid(row=start_row, column=1, padx=2)
        ttk.Button(playbar_frame, text='Stop', command=self.on_stop_button_clicked).grid(
            row=start_row, column=3, padx=2)
        ttk.Separator(playbar_frame, orient='vertical').grid(
            row=start_row, column=5, sticky="ns", padx=5)
        self.loopbutton = ttk.Checkbutton(
            playbar_frame, text='Loop', command=self.on_loop_button_toggled)
        self.loopbutton.grid(row=start_row, column=16, padx=5)
        self.loopbutton.state(['selected'])
        ttk.Separator(playbar_frame, orient='vertical').grid(
            row=start_row, column=20, sticky="ns", padx=5)
        Label(playbar_frame, text='Beats Per Minute').grid(
            row=start_row, column=25)
        self.beats_per_minute_widget = Spinbox(playbar_frame, from_=MIN_BEATS_PER_MINUTE, to=MAX_BEATS_PER_MINUTE, width=5,
                increment=5.0, command=self.on_beats_per_minute_changed)
        self.beats_per_minute_widget.grid(row=start_row, column=30)
        self.beats_per_minute_widget.delete(0,"end")
        self.beats_per_minute_widget.insert(0,INITIAL_BEATS_PER_MINUTE)
        ttk.Separator(playbar_frame, orient='vertical').grid(
            row=start_row, column=35, sticky="ns", padx=5)
        photo = PhotoImage(file='images/signature.gif')
        label = Label(playbar_frame, image=photo)
        label.image = photo
        label.grid(row=start_row, column=50, padx=1, sticky='w') 
Example #9
Source File: test_widgets.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def create(self, **kwargs):
        return ttk.Separator(self.root, **kwargs) 
Example #10
Source File: menu.py    From faceswap with GNU General Public License v3.0 5 votes vote down vote up
def _group_separator(self):
        separator = ttk.Separator(self._btn_frame, orient="vertical")
        separator.pack(padx=(2, 1), fill=tk.Y, side=tk.LEFT) 
Example #11
Source File: menu.py    From faceswap with GNU General Public License v3.0 5 votes vote down vote up
def _section_separator(self):
        frame = ttk.Frame(self)
        frame.pack(side=tk.BOTTOM, fill=tk.X)
        separator = ttk.Separator(frame, orient="horizontal")
        separator.pack(fill=tk.X, side=tk.LEFT, expand=True) 
Example #12
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 ttk.Separator(self.root, **kwargs) 
Example #13
Source File: reddit.py    From Social-Amnesia with GNU General Public License v3.0 5 votes vote down vote up
def build_window(root, window, title_text):
    def onFrameConfigure(canvas):
        '''Reset the scroll region to encompass the inner frame'''
        canvas.configure(scrollregion=canvas.bbox('all'))

    canvas = tk.Canvas(window, width=750, height=1000)
    frame = tk.Frame(canvas)

    scrollbar = tk.Scrollbar(window, command=canvas.yview)
    canvas.configure(yscrollcommand=scrollbar.set)

    scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
    canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
    canvas.create_window((4, 4), window=frame, anchor="nw")

    title_label = tk.Label(
        frame, text=title_text, font=('arial', 30))

    frame.bind("<Configure>", lambda event,
               canvas=canvas: onFrameConfigure(canvas))

    title_label.grid(
        row=0, column=0, columnspan=2, sticky='w')

    ttk.Separator(frame, orient=tk.HORIZONTAL).grid(
        row=2, columnspan=2, sticky='ew', pady=5)

    return frame 
Example #14
Source File: twitter.py    From Social-Amnesia with GNU General Public License v3.0 5 votes vote down vote up
def build_window(root, window, title_text):
    def onFrameConfigure(canvas):
        '''Reset the scroll region to encompass the inner frame'''
        canvas.configure(scrollregion=canvas.bbox('all'))

    canvas = tk.Canvas(window, width=750, height=1000)
    frame = tk.Frame(canvas)

    scrollbar = tk.Scrollbar(window, command=canvas.yview)
    canvas.configure(yscrollcommand=scrollbar.set)

    scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
    canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
    canvas.create_window((4, 4), window=frame, anchor="nw")

    title_label = tk.Label(
        frame, text=title_text, font=('arial', 30))

    frame.bind("<Configure>", lambda event,
               canvas=canvas: onFrameConfigure(canvas))

    title_label.grid(
        row=0, column=0, columnspan=2, sticky='w')

    ttk.Separator(frame, orient=tk.HORIZONTAL).grid(
        row=2, columnspan=2, sticky='ew', pady=5)

    return frame 
Example #15
Source File: progress_tab.py    From hwk-mirror with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, parent, **kwargs):
        super().__init__(parent, **kwargs)
        self.grid_columnconfigure(2, weight=1)
        self.original_order = None
        self.ticket_no = tk.Label(self, font=self.font, relief=tk.SUNKEN, bd=1, bg="white")
        self.index = None
        self.completed = False
        self.is_gridded = False
        
        self.progress = ProgressBar(self)
        self.cancel_button = LabelButton(self, "Cancel", width=7, font=self.font, bg="red", command=self.on_cancel)
        self.modify_button = LabelButton(self, "Modify", width=7, font=self.font, command=self.on_modify)
        
        self.confirm_cancel = ConfirmationFrame(self, font=self.font)
        self.confirm_cancel.set_confirm(self.on_cancel_confirm)
        self.confirm_cancel.set_return(self.on_cancel_return)
        
        self.confirm_modify = ConfirmationFrame(self, first="Return", font=self.font)
        self.confirm_modify.set_confirm(self.on_modify_confirm)
        self.confirm_modify.set_return(self.on_modify_return)

        ttk.Separator(self, orient=tk.HORIZONTAL).grid(
                row=0, column=0,
                columnspan=5,
                sticky="we",
                pady=2)

        self.ticket_no.grid(row=1, column=0,
                sticky="nswe",
                padx=2)
        self.progress.grid(row=1, column=1,
                sticky="nswe",
                columnspan=2,
                padx=2)
        
        self.modify_button.grid(row=1, column=3, 
                padx=2,
                sticky="nswe")
        
        self.cancel_button.grid(row=1, column=4,
                padx=2,
                sticky="nswe")
        
        self.confirm_cancel.grid(row=1, column=3,
                columnspan=2,
                sticky="nswe")
        
        self.modify_button.lift()
        self.cancel_button.lift() 
Example #16
Source File: reddit.py    From Social-Amnesia with GNU General Public License v3.0 4 votes vote down vote up
def set_reddit_whitelist(root, comment_bool, reddit_state):
    """
    Creates a window to let users select which comments or posts
        to whitelist
    :param root: the reference to the actual tkinter GUI window
    :param comment_bool: true for comments, false for posts
    :param reddit_state: dictionary holding reddit settings
    :return: none
    """
    # TODO: update this to get whether checkbox is selected or unselected instead of blindly flipping from true to false
    def flip_whitelist_dict(id, identifying_text):
        whitelist_dict = reddit_state[f'whitelisted_{identifying_text}']
        whitelist_dict[id] = not whitelist_dict[id]
        reddit_state[f'whitelisted_{identifying_text}'] = whitelist_dict
        reddit_state.sync

    if reddit_state['whitelist_window_open'] == 1:
        return

    if comment_bool:
        identifying_text = 'comments'
        item_array = reddit_state['user'].comments.new(limit=None)
    else:
        identifying_text = 'posts'
        item_array = reddit_state['user'].submissions.new(limit=None)

    whitelist_window = tk.Toplevel(root)
    reddit_state['whitelist_window_open'] = 1
    reddit_state.sync

    whitelist_window.protocol(
        'WM_DELETE_WINDOW', lambda: close_window(whitelist_window, reddit_state, 'whitelist_window_open'))

    frame = build_window(root, whitelist_window,
                         f'Pick {identifying_text} to save')

    counter = 3
    for item in item_array:
        if (item.id not in reddit_state[f'whitelisted_{identifying_text}']):
            # I wish I could tell you why I need to copy the dictionary of whitelisted items, and then modify it, and then
            #   reassign it back to the persistant shelf. I don't know why this is needed, but it works.
            whitelist_dict = reddit_state[f'whitelisted_{identifying_text}']
            whitelist_dict[item.id] = False
            reddit_state[f'whitelisted_{identifying_text}'] = whitelist_dict
            reddit_state.sync

        whitelist_checkbutton = tk.Checkbutton(frame, command=lambda
                                               id=item.id: flip_whitelist_dict(id, identifying_text))

        if (reddit_state[f'whitelisted_{identifying_text}'][item.id]):
            whitelist_checkbutton.select()
        else:
            whitelist_checkbutton.deselect()

        whitelist_checkbutton.grid(row=counter, column=0)
        tk.Label(frame,
                 text=helpers.format_snippet(item.body if comment_bool else item.title, 100)).grid(row=counter, column=1)
        ttk.Separator(frame, orient=tk.HORIZONTAL).grid(
            row=counter+1, columnspan=2, sticky=(tk.E, tk.W), pady=5)

        counter = counter + 2