当前位置: 首页>>代码示例>>Python>>正文


Python ttk.Separator方法代码示例

本文整理汇总了Python中tkinter.ttk.Separator方法的典型用法代码示例。如果您正苦于以下问题:Python ttk.Separator方法的具体用法?Python ttk.Separator怎么用?Python ttk.Separator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tkinter.ttk的用法示例。


在下文中一共展示了ttk.Separator方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Separator [as 别名]
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") 
开发者ID:BnetButter,项目名称:hwk-mirror,代码行数:25,代码来源:options.py

示例2: layout_general_widgets

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Separator [as 别名]
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) 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:15,代码来源:Preferences.py

示例3: add_toolbar_buttons

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Separator [as 别名]
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) 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:12,代码来源:__init__.py

示例4: __create_layout

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Separator [as 别名]
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() 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:17,代码来源:Dock.py

示例5: __init__

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Separator [as 别名]
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 
开发者ID:BnetButter,项目名称:hwk-mirror,代码行数:14,代码来源:progress_tab.py

示例6: create_widgets

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Separator [as 别名]
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) 
开发者ID:araith,项目名称:pyDEA,代码行数:35,代码来源:categories_checkbox_gui.py

示例7: create

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Separator [as 别名]
def create(self, **kwargs):
        return ttk.Separator(self.root, **kwargs) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:4,代码来源:test_widgets.py

示例8: create_play_bar

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Separator [as 别名]
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') 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Application-Development-Blueprints-Second-Edition,代码行数:34,代码来源:3.12.py

示例9: _group_separator

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Separator [as 别名]
def _group_separator(self):
        separator = ttk.Separator(self._btn_frame, orient="vertical")
        separator.pack(padx=(2, 1), fill=tk.Y, side=tk.LEFT) 
开发者ID:deepfakes,项目名称:faceswap,代码行数:5,代码来源:menu.py

示例10: _section_separator

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Separator [as 别名]
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) 
开发者ID:deepfakes,项目名称:faceswap,代码行数:7,代码来源:menu.py

示例11: build_window

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Separator [as 别名]
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 
开发者ID:Nick-Gottschlich,项目名称:Social-Amnesia,代码行数:30,代码来源:reddit.py

示例12: set_reddit_whitelist

# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Separator [as 别名]
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 
开发者ID:Nick-Gottschlich,项目名称:Social-Amnesia,代码行数:63,代码来源:reddit.py


注:本文中的tkinter.ttk.Separator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。