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


Python ttk.Scrollbar方法代码示例

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


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

示例1: configure_treeview

# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Scrollbar [as 别名]
def configure_treeview(self):
        self.treeview = ttk.Treeview(self)
        self.treeview['columns'] = ["id", "time", 'ms_level', 'precursor_mz', 'precursor_charge', 'activation']
        self.treeview.grid(row=2, column=0, sticky=tk.S + tk.W + tk.E + tk.N)

        self.treeview_scrollbar = ttk.Scrollbar(self, orient="vertical", command=self.treeview.yview)
        self.treeview_scrollbar.grid(row=2, column=0, sticky=tk.S + tk.E + tk.N)
        self.treeview.configure(yscrollcommand=self.treeview_scrollbar.set)

        self.treeview.heading('id', text="Scan ID")
        self.treeview.heading('#0', text='Index')
        self.treeview.heading("time", text='Time (min)')
        self.treeview.heading("ms_level", text='MS Level')
        self.treeview.heading("precursor_mz", text='Precursor M/Z')
        self.treeview.heading("precursor_charge", text='Precursor Z')
        self.treeview.heading("activation", text='Activation')
        self.treeview.column("#0", width=75)
        self.treeview.column("ms_level", width=75)
        self.treeview.column("time", width=75)
        self.treeview.column("precursor_mz", width=100)
        self.treeview.column("precursor_charge", width=100)
        self.treeview.bind("<<TreeviewSelect>>", self.on_row_click) 
开发者ID:mobiusklein,项目名称:ms_deisotope,代码行数:24,代码来源:view.py

示例2: __init__

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

示例3: __init__

# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Scrollbar [as 别名]
def __init__(self, master, radios, font, changed, **kwargs):
                tk.Frame.__init__(self, master)

                self.master = master
                self.radios = radios
                self.font = font
                self.changed = changed

                self.scrollv = tk.Scrollbar(self, orient = "vertical")
                self.textbox = tk.Text(self, yscrollcommand = self.scrollv.set, **kwargs)
                self.scrollv.config(command = self.textbox.yview)
                # layout.
                self.scrollv.pack(side = "right", fill = "y")
                self.textbox.pack(side = "left", fill = "both", expand = True)
                # create radiobuttons.
                self.radiovar = tk.StringVar()
                self.radiovar.set('FILE')
                self.create() 
开发者ID:SystemRage,项目名称:py-kms,代码行数:20,代码来源:pykms_GuiMisc.py

示例4: __init__

# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Scrollbar [as 别名]
def __init__(self, master, factor = 0.5, **kwargs):
        self.__scrollableWidgets = []

        if 'orient' in kwargs:
            if kwargs['orient']== tk.VERTICAL:
                self.__orientLabel = 'y'
            elif kwargs['orient']== tk.HORIZONTAL:
                self.__orientLabel = 'x'
            else:
                raise Exception("Bad 'orient' argument in scrollbar.")
        else:
            self.__orientLabel = 'y'

        kwargs['command'] = self.onScroll
        self.factor = factor

        ttk.Scrollbar.__init__(self, master, **kwargs) 
开发者ID:ActiveState,项目名称:code,代码行数:19,代码来源:recipe-578874.py

示例5: _set_up_tree_widget

# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Scrollbar [as 别名]
def _set_up_tree_widget(self):

        tree_container = ttk.Frame(self.container)

        tree_container.grid(row=0, column=0, sticky=tk.W+tk.E+tk.N+tk.S)

        #tree_container.pack(fill='both', expand=True)

        # create a treeview with dual scrollbars
        self.tree = ttk.Treeview(tree_container, columns=self.headers, show="headings")
        
        vsb = ttk.Scrollbar(tree_container, orient="vertical", command=self.tree.yview)
        hsb = ttk.Scrollbar(tree_container, orient="horizontal", command=self.tree.xview)

        self.tree.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set)
        self.tree.grid(column=0, row=0, sticky='nsew')

        vsb.grid(column=1, row=0, sticky='ns')
        hsb.grid(column=0, row=1, sticky='ew')

        tree_container.grid_columnconfigure(0, weight=1)
        tree_container.grid_rowconfigure(0, weight=1)

        self.tree.bind("<Double-1>", self.double_click) 
开发者ID:PCWG,项目名称:PCWG,代码行数:26,代码来源:grid_box.py

示例6: create

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

示例7: __init__

# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Scrollbar [as 别名]
def __init__(self, master):
        try:
            vsb = ttk.Scrollbar(master, orient='vertical', command=self.yview)
        except:
            pass
        hsb = ttk.Scrollbar(master, orient='horizontal', command=self.xview)

        try:
            self.configure(yscrollcommand=self._autoscroll(vsb))
        except:
            pass
        self.configure(xscrollcommand=self._autoscroll(hsb))

        self.grid(column=0, row=0, sticky='nsew')
        try:
            vsb.grid(column=1, row=0, sticky='ns')
        except:
            pass
        hsb.grid(column=0, row=1, sticky='ew')

        master.grid_columnconfigure(0, weight=1)
        master.grid_rowconfigure(0, weight=1)

        if py3:
            methods = tk.Pack.__dict__.keys() | tk.Grid.__dict__.keys() \
                  | tk.Place.__dict__.keys()
        else:
            methods = tk.Pack.__dict__.keys() + tk.Grid.__dict__.keys() \
                  + tk.Place.__dict__.keys()

        for meth in methods:
            if meth[0] != '_' and meth not in ('config', 'configure'):
                setattr(self, meth, getattr(master, meth)) 
开发者ID:Technowlogy-Pushpender,项目名称:nekros,代码行数:35,代码来源:check_log_gui.py

示例8: __init__

# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Scrollbar [as 别名]
def __init__(self, master):
        #  Rozen. Added the try-except clauses so that this class
        #  could be used for scrolled entry widget for which vertical
        #  scrolling is not supported. 5/7/14.
        try:
            vsb = ttk.Scrollbar(master, orient='vertical', command=self.yview)
        except:
            pass
        hsb = ttk.Scrollbar(master, orient='horizontal', command=self.xview)

        #self.configure(yscrollcommand=_autoscroll(vsb),
        #    xscrollcommand=_autoscroll(hsb))
        try:
            self.configure(yscrollcommand=self._autoscroll(vsb))
        except:
            pass
        self.configure(xscrollcommand=self._autoscroll(hsb))

        self.grid(column=0, row=0, sticky='nsew')
        try:
            vsb.grid(column=1, row=0, sticky='ns')
        except:
            pass
        hsb.grid(column=0, row=1, sticky='ew')

        master.grid_columnconfigure(0, weight=1)
        master.grid_rowconfigure(0, weight=1)

        # Copy geometry methods of master  (taken from ScrolledText.py)
        if py3:
            methods = tk.Pack.__dict__.keys() | tk.Grid.__dict__.keys() \
                  | tk.Place.__dict__.keys()
        else:
            methods = tk.Pack.__dict__.keys() + tk.Grid.__dict__.keys() \
                  + tk.Place.__dict__.keys()

        for meth in methods:
            if meth[0] != '_' and meth not in ('config', 'configure'):
                setattr(self, meth, getattr(master, meth)) 
开发者ID:Technowlogy-Pushpender,项目名称:nekros,代码行数:41,代码来源:GUI.py

示例9: __init__

# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Scrollbar [as 别名]
def __init__(self, master):
        #  Rozen. Added the try-except clauses so that this class
        #  could be used for scrolled entry widget for which vertical
        #  scrolling is not supported. 5/7/14.
        try:
            vsb = ttk.Scrollbar(master, orient='vertical', command=self.yview)
        except:
            pass
        hsb = ttk.Scrollbar(master, orient='horizontal', command=self.xview)

        # self.configure(yscrollcommand=_autoscroll(vsb),
        #    xscrollcommand=_autoscroll(hsb))
        try:
            self.configure(yscrollcommand=self._autoscroll(vsb))
        except:
            pass
        self.configure(xscrollcommand=self._autoscroll(hsb))

        self.grid(column=0, row=0, sticky='nsew')
        try:
            vsb.grid(column=1, row=0, sticky='ns')
        except:
            pass
        hsb.grid(column=0, row=1, sticky='ew')

        master.grid_columnconfigure(0, weight=1)
        master.grid_rowconfigure(0, weight=1)

        # Copy geometry methods of master  (taken from ScrolledText.py)
        if py3:
            methods = Pack.__dict__.keys() | Grid.__dict__.keys() \
                      | Place.__dict__.keys()
        else:
            methods = Pack.__dict__.keys() + Grid.__dict__.keys() \
                      + Place.__dict__.keys()

        for meth in methods:
            if meth[0] != '_' and meth not in ('config', 'configure'):
                setattr(self, meth, getattr(master, meth)) 
开发者ID:shmilylty,项目名称:cheetah-gui,代码行数:41,代码来源:cheetah_proxy.py

示例10: set

# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Scrollbar [as 别名]
def set(self, lo_val, hi_val):  #pylint: disable=W0221
        if float(lo_val) <= 0.0 and float(hi_val) >= 1.0:
            self.grid_remove()
        else:
            self.grid()
        ttk.Scrollbar.set(self, lo_val, hi_val) 
开发者ID:felipeochoa,项目名称:minecart,代码行数:8,代码来源:viewer.py

示例11: new_query_tab

# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Scrollbar [as 别名]
def new_query_tab(self, title, query):
        """add a Tab 'title' to the notebook, containing the Script 'query'"""

        fw_welcome = ttk.Panedwindow(self.tk_win, orient=VERTICAL)  # tk_win
        fw_welcome.pack(fill='both', expand=True)
        self.notebook.add(fw_welcome, text=(title))

        # new "editable" script
        f1 = ttk.Labelframe(fw_welcome, text='Script', width=200, height=100)
        fw_welcome.add(f1)
        fw_label = Text(f1, bd=1, undo=True)

        scroll = ttk.Scrollbar(f1, command=fw_label.yview)
        fw_label.configure(yscrollcommand=scroll.set)
        fw_label.insert(END, (query))
        fw_label.pack(side=LEFT, expand=YES, fill=BOTH, padx=2, pady=2)
        scroll.pack(side=RIGHT, expand=NO, fill=BOTH, padx=2, pady=2)

        # keep tab reference  by tk id
        working_tab_id = "." + fw_welcome._name

        # keep tab reference to script (by tk id)
        self.fw_labels[working_tab_id] = fw_label

        # new "Results" Container
        fr = ttk.Labelframe(fw_welcome, text='Results', width=200, height=100)
        fw_welcome.add(fr)

        # containing a notebook
        fw_result_nb = Notebook(fr, style="ButtonNotebook")
        fw_result_nb.pack(fill='both', expand=True)
        # resize rules
        fw_welcome.columnconfigure(0, weight=1)
        # keep reference to result_nb objects (by tk id)
        self.fw_result_nbs[working_tab_id] = fw_result_nb

        # activate this tab print(self.notebook.tabs())
        self.notebook.select(working_tab_id)
        # workaround to have a visible result pane on initial launch
        self.add_treeview(
            working_tab_id, "_", "", "click on ('->') to run Script")
        return working_tab_id  # gives back tk_id reference of the new tab 
开发者ID:stonebig,项目名称:sqlite_bro,代码行数:44,代码来源:sqlite_bro.py


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