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


Python tkinter.HORIZONTAL属性代码示例

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


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

示例1: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [as 别名]
def __init__(self, master, gui):
        super().__init__(master, text="output: Tremolo")
        self.gui = gui
        self.input_waveform = tk.StringVar()
        self.input_waveform.set("<off>")
        self.input_rate = tk.DoubleVar()
        self.input_depth = tk.DoubleVar()
        self.input_rate.set(5)
        self.input_depth.set(80)
        row = 0
        tk.Label(self, text="waveform").grid(row=row, column=0)
        values = ["<off>", "sine", "triangle", "sawtooth", "square"]
        menu = tk.OptionMenu(self, self.input_waveform, *values)
        menu["width"] = 10
        menu.grid(row=row, column=1)
        row += 1
        tk.Label(self, text="rate").grid(row=row, column=0, sticky=tk.E)
        tk.Scale(self, orient=tk.HORIZONTAL, variable=self.input_rate, from_=0.0, to=10.0, resolution=.1,
                 width=10, length=100).grid(row=row, column=1)
        row += 1
        tk.Label(self, text="depth").grid(row=row, column=0, sticky=tk.E)
        tk.Scale(self, orient=tk.HORIZONTAL, variable=self.input_depth, from_=0.0, to=1.0, resolution=.02,
                 width=10, length=100).grid(row=row, column=1) 
开发者ID:irmen,项目名称:synthesizer,代码行数:25,代码来源:keyboard_gui.py

示例2: configure

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [as 别名]
def configure(self, cnf={}, **kwargs):
        """Update options of the TimeLine widget"""
        kwargs.update(cnf)
        TimeLine.check_kwargs(kwargs)
        scrollbars = 'autohidescrollbars' in kwargs
        for option in self.options:
            attribute = "_" + option
            setattr(self, attribute, kwargs.pop(option, getattr(self, attribute)))
        if scrollbars:
            self._scrollbar_timeline.destroy()
            self._scrollbar_vertical.destroy()
            if self._autohidescrollbars:
                self._scrollbar_timeline = AutoHideScrollbar(self, command=self._set_scroll, orient=tk.HORIZONTAL)
                self._scrollbar_vertical = AutoHideScrollbar(self, command=self._set_scroll_v, orient=tk.VERTICAL)
            else:
                self._scrollbar_timeline = ttk.Scrollbar(self, command=self._set_scroll, orient=tk.HORIZONTAL)
                self._scrollbar_vertical = ttk.Scrollbar(self, command=self._set_scroll_v, orient=tk.VERTICAL)
            self._canvas_scroll.config(xscrollcommand=self._scrollbar_timeline.set,
                                       yscrollcommand=self._scrollbar_vertical.set)
            self._canvas_categories.config(yscrollcommand=self._scrollbar_vertical.set)
            self._scrollbar_timeline.grid(column=1, row=2, padx=(0, 5), pady=(0, 5), sticky="we")
            self._scrollbar_vertical.grid(column=2, row=0, pady=5, padx=(0, 5), sticky="ns")
        ttk.Frame.configure(self, **kwargs)
        self.draw_timeline() 
开发者ID:TkinterEP,项目名称:ttkwidgets,代码行数:26,代码来源:timeline.py

示例3: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [as 别名]
def __init__(self, master=None, initlist=None, orient=tk.HORIZONTAL, reverse=False):
        super().__init__(initlist)
        self.offset = 0
        self.show = 5 if initlist is None else len(initlist)
        self.last_list_len = None
        self._reverse = reverse
        if reverse:
           self.skip = -1
        else:
            self.skip = 1

        if orient == tk.HORIZONTAL:
            master.bind_all("<KP_Left>", self.inc_offset if reverse else self.dec_offset)
            master.bind_all("<KP_Right>", self.dec_offset if reverse else self.inc_offset)

        elif orient == tk.VERTICAL:
            master.bind_all("<KP_Up>", self.inc_offset if reverse else self.dec_offset)
            master.bind_all("<KP_Down>", self.dec_offset if reverse else self.inc_offset)
        else:
            raise ValueError
        self.orient = orient 
开发者ID:BnetButter,项目名称:hwk-mirror,代码行数:23,代码来源:scroll.py

示例4: grid_inner

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [as 别名]
def grid_inner(self, **kwargs):
        if self.orient == tk.HORIZONTAL:
            self._interior.grid_rowconfigure(0, weight=1)
            for i, widget in enumerate(self.scroller):
                self._interior.grid_columnconfigure(i, weight=1)
                widget.grid(row=0, column=i, **kwargs)
            if self.scroller._reverse:
                self._interior.grid_columnconfigure(len(self.scroller)-1, weight=0)
            else:
                self._interior.grid_columnconfigure(0, weight=0)
        elif self.orient == tk.VERTICAL:
            self._interior.grid_columnconfigure(0, weight=1)
            for i, widget in enumerate(self.scroller):
                self._interior.grid_rowconfigure(i, weight=2)
                widget.grid(row=i, column=0, **kwargs)
            # widgets that are first must fully expand
            if self.scroller._reverse:
                self._interior.grid_rowconfigure(len(self.scroller)-1, weight=0)
            else:
                self._interior.grid_rowconfigure(0, weight=0) 
开发者ID:BnetButter,项目名称:hwk-mirror,代码行数:22,代码来源:scroll.py

示例5: create_widgets

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [as 别名]
def create_widgets(self):
        ''' Creates all widgets.
        '''
        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(0, weight=1)

        xscrollbar = Scrollbar(self, orient=HORIZONTAL)
        xscrollbar.grid(row=1, column=0, sticky=E+W)

        yscrollbar = Scrollbar(self)
        yscrollbar.grid(row=0, column=1, sticky=N+S)

        self.text = Text(self, wrap=NONE,
                         xscrollcommand=xscrollbar.set,
                         yscrollcommand=yscrollbar.set)

        self.text.bind("<Control-Key-a>", self.select_all)
        self.text.bind("<Control-Key-A>", self.select_all)

        self.text.grid(row=0, column=0, sticky=N+S+E+W)

        xscrollbar.config(command=self.text.xview)
        yscrollbar.config(command=self.text.yview) 
开发者ID:araith,项目名称:pyDEA,代码行数:25,代码来源:text_frame_gui.py

示例6: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [as 别名]
def __init__(self, master, width=500, height=350,
                                          canvwidth=600, canvheight=500):
        TK.Frame.__init__(self, master, width=width, height=height)
        self._rootwindow = self.winfo_toplevel()
        self.width, self.height = width, height
        self.canvwidth, self.canvheight = canvwidth, canvheight
        self.bg = "white"
        self._canvas = TK.Canvas(master, width=width, height=height,
                                 bg=self.bg, relief=TK.SUNKEN, borderwidth=2)
        self.hscroll = TK.Scrollbar(master, command=self._canvas.xview,
                                    orient=TK.HORIZONTAL)
        self.vscroll = TK.Scrollbar(master, command=self._canvas.yview)
        self._canvas.configure(xscrollcommand=self.hscroll.set,
                               yscrollcommand=self.vscroll.set)
        self.rowconfigure(0, weight=1, minsize=0)
        self.columnconfigure(0, weight=1, minsize=0)
        self._canvas.grid(padx=1, in_ = self, pady=1, row=0,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.vscroll.grid(padx=1, in_ = self, pady=1, row=0,
                column=1, rowspan=1, columnspan=1, sticky='news')
        self.hscroll.grid(padx=1, in_ = self, pady=1, row=1,
                column=0, rowspan=1, columnspan=1, sticky='news')
        self.reset()
        self._rootwindow.bind('<Configure>', self.onResize) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:26,代码来源:turtle.py

示例7: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [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

示例8: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [as 别名]
def __init__(self, parent, phy_monitor, property_name: str, max_value=None, **kwargs):
        super(PropertySlider, self).__init__(parent, **kwargs)
        
        self.phy_monitor = phy_monitor
        self.property_name = property_name
        
        # get Max Value
        if max_value:
            self.max_value = max_value
        else:
            _LOGGER.warning("'max_value' not set, set max_value=100")
            self.max_value = 100
        
        self.var = tk.IntVar()
        self.var.set(_get_attr(self.phy_monitor, self.property_name))
        self.configure(orient=tk.HORIZONTAL, from_=0,
                       to=self.max_value,
                       variable=self.var,
                       length=200,
                       showvalue=1)
        
        # 如果让 Widget 的操作即时响应,可能会导致发送vcp指令太频繁而报错,所以在鼠标放开后才设置新的值
        self.bind('<ButtonRelease-1>',
                  lambda event: _set_attr(self.phy_monitor, self.property_name, self.var.get())) 
开发者ID:dot-osk,项目名称:monitor_ctrl,代码行数:26,代码来源:tkui.py

示例9: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [as 别名]
def __init__(self, master, im, value=128):
        tkinter.Frame.__init__(self, master)

        self.image = im
        self.value = value

        self.canvas = tkinter.Canvas(self, width=im.size[0], height=im.size[1])
        self.backdrop = ImageTk.PhotoImage(im)
        self.canvas.create_image(0, 0, image=self.backdrop, anchor=tkinter.NW)
        self.canvas.pack()

        scale = tkinter.Scale(self, orient=tkinter.HORIZONTAL, from_=0, to=255,
                              resolution=1, command=self.update_scale,
                              length=256)
        scale.set(value)
        scale.bind("<ButtonRelease-1>", self.redraw)
        scale.pack()

        # uncomment the following line for instant feedback (might
        # be too slow on some platforms)
        # self.redraw() 
开发者ID:awslabs,项目名称:mxnet-lambda,代码行数:23,代码来源:thresholder.py

示例10: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [as 别名]
def __init__(self, master, image, name, enhancer, lo, hi):
        tkinter.Frame.__init__(self, master)

        # set up the image
        self.tkim = ImageTk.PhotoImage(image.mode, image.size)
        self.enhancer = enhancer(image)
        self.update("1.0")  # normalize

        # image window
        tkinter.Label(self, image=self.tkim).pack()

        # scale
        s = tkinter.Scale(self, label=name, orient=tkinter.HORIZONTAL,
                  from_=lo, to=hi, resolution=0.01,
                  command=self.update)
        s.set(self.value)
        s.pack() 
开发者ID:awslabs,项目名称:mxnet-lambda,代码行数:19,代码来源:enhancer.py

示例11: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [as 别名]
def __init__(self, root, imagesList, final_img_size):
        super(SliderGalleryFrame, self).__init__(root)
        self.master.minsize(width=100, height=100)
        self.master.config()

        self.master.bind('<Left>', self.left_key)
        self.master.bind('<Right>', self.right_key)

        self.main_frame = tk.Frame()
        self.main_frame.pack(fill='both', expand=True)

        self.imagesList = imagesList

        self.panel = tk.Label(root, image=self.imagesList[0])
        self.panel.pack(side="bottom", fill="both", expand="yes")

        self.var = tk.IntVar()
        self.scale = tk.Scale(root, from_=0, to=len(imagesList) - 1, variable=self.var, orient=tk.HORIZONTAL,
                         command=self.sel, width=20, length=final_img_size)
        self.scale.pack(anchor=tk.N)

        self.pack() 
开发者ID:Tetraquark,项目名称:pubgheatmap,代码行数:24,代码来源:slider_gallery_frame.py

示例12: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [as 别名]
def __init__(self, path):
        super().__init__()
        self.title("Ttk Treeview")

        abspath = os.path.abspath(path)
        self.nodes = {}
        self.tree = ttk.Treeview(self)
        self.tree.heading("#0", text=abspath, anchor=tk.W)
        ysb = ttk.Scrollbar(self, orient=tk.VERTICAL,
                            command=self.tree.yview)
        xsb = ttk.Scrollbar(self, orient=tk.HORIZONTAL,
                            command=self.tree.xview)
        self.tree.configure(yscroll=ysb.set, xscroll=xsb.set)

        self.tree.grid(row=0, column=0, sticky=tk.N + tk.S + tk.E + tk.W)
        ysb.grid(row=0, column=1, sticky=tk.N + tk.S)
        xsb.grid(row=1, column=0, sticky=tk.E + tk.W)
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)

        self.tree.bind("<<TreeviewOpen>>", self.open_node)
        self.populate_node("", abspath) 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Application-Development-Cookbook,代码行数:24,代码来源:chapter8_04.py

示例13: set_potential_sliders

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [as 别名]
def set_potential_sliders(self) -> None:
        """
        Set the sliders for the parameters that control
        the potential function.
        """
        for i in range(len(self.V_params)):
            self.sliders2.append(
                tk.Scale(self.window, 
                         label="change %s: " % str(self.V_params[i][0]),
                         from_=-2, to=2,
                         resolution=0.01,
                         orient=tk.HORIZONTAL,
                         length=200,
                         command=self.update_potential_by_slider
                         )
            )
            self.sliders2[i].grid(
                row=17 + self.sliders2_count + self.sliders1_count, 
                column=3, columnspan=2, 
                sticky=tk.N+tk.W+tk.E, padx=(10, 10)
            )
            self.sliders2[i].set(self.V_params[i][1])
            self.sliders2_count += 1 
开发者ID:marl0ny,项目名称:QM-Simulator-1D,代码行数:25,代码来源:app.py

示例14: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [as 别名]
def __init__(self, master):
        ttk.Label(master, text = "PROGRESS CONTROL").pack()
        
        # Inderterminant Progressbar
        ttk.Label(master, text = 'Inderterminant Progress').pack()
        self.prgrsbr_indtr = ttk.Progressbar(master, orient = tk.HORIZONTAL, length = 300, mode = 'indeterminate')
        self.prgrsbr_indtr.pack()
        self.checkpbi = tk.StringVar()
        self.checkpbi.set("Start")
        
        # Button
        self.btn1 = ttk.Button(master, text = "{} Inderterminant Progress Bar".format(self.checkpbi.get()), command = self.btn1cmd)
        self.btn1.pack()

        # Derterminant progress
        ttk.Label(master, text = 'Derterminant Progress').pack()
        self.prgrsbr_dtr = ttk.Progressbar(master, orient=tk.HORIZONTAL, length = 300, mode = 'determinate')
        self.prgrsbr_dtr.pack()
        self.prgrsbr_dtr.config(maximum = 10.0, value = 2.0)    # notice both these properties have float values
        
        # Button
        ttk.Button(master, text = 'Reset Progress Bar to zero', command = self.resetProgressBarVal).pack()
        
        # Button
        ttk.Button(master, text = 'Increase Progress Bar by 2', command = self.shift2ProgressBarVal).pack()
        
        # create double variable
        self.prgrsBrVal = tk.DoubleVar()
        
        self.prgrsbr_dtr.config(variable = self.prgrsBrVal) # set variable property of progressbar to look at DoubleVar()
        
        # Scale widget
        self.scalebar = ttk.Scale(master, orient = tk.HORIZONTAL, length = 400, variable=self.prgrsBrVal, from_ = 0.0, to= 10.0)
        self.scalebar.pack()
        
        # Label to display current value of scalebar
        ttk.Label(master, text = "Current value of Progress Bar is as below:").pack()
        self.scalebar_label = ttk.Label(master, textvariable = self.prgrsBrVal)
        self.scalebar_label.pack() 
开发者ID:adipandas,项目名称:python-gui-demos,代码行数:41,代码来源:program8.py

示例15: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import HORIZONTAL [as 别名]
def __init__(self, master):
        self.master = master
        self.panedWindow = ttk.Panedwindow(self.master, orient = tk.HORIZONTAL)  # orient panes horizontally next to each other
        self.panedWindow.pack(fill = tk.BOTH, expand = True)    # occupy full master window and enable expand property
        
        self.frame1 = ttk.Frame(self.panedWindow, width = 100, height = 300, relief = tk.SUNKEN)
        self.frame2 = ttk.Frame(self.panedWindow, width = 400, height = 400, relief = tk.SUNKEN)
        
        self.panedWindow.add(self.frame1, weight = 1)
        self.panedWindow.add(self.frame2, weight = 3)
        
        self.button = ttk.Button(self.frame1, text = 'Add frame in Paned Window', command = self.AddFrame)
        self.button.pack() 
开发者ID:adipandas,项目名称:python-gui-demos,代码行数:15,代码来源:program11.py


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