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


Python tkinter.S属性代码示例

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


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

示例1: create_statusbar

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import S [as 别名]
def create_statusbar(self):
        statusBar = ttk.Frame(self.master)
        statusLabel = ttk.Label(statusBar, textvariable=self.statusText)
        statusLabel.grid(column=0, row=0, sticky=(tk.W, tk.E))
        self.modifiedLabel = ttk.Label(statusBar, relief=tk.SUNKEN,
                anchor=tk.CENTER)
        self.modifiedLabel.grid(column=1, row=0, pady=2, padx=1)
        TkUtil.Tooltip.Tooltip(self.modifiedLabel,
                text="MOD if the text has unsaved changes")
        self.positionLabel = ttk.Label(statusBar, relief=tk.SUNKEN,
                anchor=tk.CENTER)
        self.positionLabel.grid(column=2, row=0, sticky=(tk.W, tk.E),
                pady=2, padx=1)
        TkUtil.Tooltip.Tooltip(self.positionLabel,
                text="Current line and column position")
        ttk.Sizegrip(statusBar).grid(row=0, column=4, sticky=(tk.S, tk.E))
        statusBar.columnconfigure(0, weight=1)
        statusBar.grid(row=2, column=0, columnspan=3, sticky=(tk.W, tk.E))
        self.set_status_text("Start typing to create a new document or "
                "click File→Open") 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:22,代码来源:Main.py

示例2: create_window

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import S [as 别名]
def create_window(self):
    self.root.grid_rowconfigure(1,weight=1)
    self.root.grid_columnconfigure(0,weight=1)
    self.img_label = tk.Label(self.root)
    self.img_label.configure(image=self.c_img)
    self.hist_label = tk.Label(self.root)
    self.hist_label.grid(row=0,column=0)
    #self.img_label.pack(fill=tk.BOTH)
    self.img_label.grid(row=1,column=0,
        rowspan=len(self.camera.settings_dict)+2, sticky=tk.N+tk.E+tk.S+tk.W)
    self.create_inputs()
    self.create_infos()
    self.img_label.bind('<Motion>', self.update_reticle)
    self.img_label.bind('<4>', self.zoom_in)
    self.img_label.bind('<5>', self.zoom_out)
    self.root.bind('<MouseWheel>', self.zoom)
    self.img_label.bind('<1>', self.start_move)
    self.img_label.bind('<B1-Motion>', self.move) 
开发者ID:LaboratoireMecaniqueLille,项目名称:crappy,代码行数:20,代码来源:cameraConfig.py

示例3: configure_canvas

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import S [as 别名]
def configure_canvas(self):
        self.figure = Figure(dpi=100)
        self.canvas = FigureCanvasTkAgg(self.figure, master=self)
        self.axis = self.figure.add_subplot(111)
        self.canvas.draw()
        canvas_widget = self.canvas.get_tk_widget()
        canvas_widget.grid(row=0, column=0, sticky=tk.N + tk.W + tk.E + tk.S)
        self.canvas_cursor = Cursor(self.axis, tk.StringVar(master=self.root))
        self.canvas.mpl_connect('motion_notify_event', self.canvas_cursor.mouse_move)
        self.span = SpanSelector(
            self.axis, self.zoom, 'horizontal', useblit=True,
            rectprops=dict(alpha=0.5, facecolor='red'))
        self.mz_span = None
        self.scan = None
        self.annotations = []
        self.canvas.draw() 
开发者ID:mobiusklein,项目名称:ms_deisotope,代码行数:18,代码来源:view.py

示例4: configure_treeview

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

示例5: create_widgets

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import S [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 S [as 别名]
def __init__(self, frame):
        self.frame = frame
        # Create a ScrolledText wdiget
        self.scrolled_text = ScrolledText(frame, state='disabled', height=12)
        self.scrolled_text.grid(row=0, column=0, sticky=(N, S, W, E))
        self.scrolled_text.configure(font='TkFixedFont')
        self.scrolled_text.tag_config('INFO', foreground='black')
        self.scrolled_text.tag_config('DEBUG', foreground='gray')
        self.scrolled_text.tag_config('WARNING', foreground='orange')
        self.scrolled_text.tag_config('ERROR', foreground='red')
        self.scrolled_text.tag_config('CRITICAL', foreground='red', underline=1)
        # Create a logging handler using a queue
        self.log_queue = queue.Queue()
        self.queue_handler = QueueHandler(self.log_queue)
        formatter = logging.Formatter('%(asctime)s: %(message)s')
        self.queue_handler.setFormatter(formatter)
        logger.addHandler(self.queue_handler)
        # Start polling messages from the queue
        self.frame.after(100, self.poll_log_queue) 
开发者ID:beenje,项目名称:tkinter-logging-text-widget,代码行数:21,代码来源:main.py

示例7: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import S [as 别名]
def __init__(self, root, label, row, col):
        tkinter.Frame.__init__(self, root, bg='#cecece')
        # Set non-zero weight.
        root.columnconfigure(col, weight=1)
        root.rowconfigure(row, weight=1)
        # Information being displayed.
        self.label_text = label
        self.info = ''
        # Set up label.
        text = '{0}: {1}'.format(self.label_text, self.info)
        self.label = tkinter.Label(
            self,
            text=text,
            bg='#cecece'
        )
        self.label.place(relx=0.5, rely=0.5, anchor='c')
        # Position frame.
        self.grid(
            row=row,
            column=col,
            sticky=tkinter.N + tkinter.S + tkinter.E + tkinter.W
        )

    # Update info. 
开发者ID:KYDronePilot,项目名称:hdfm,代码行数:26,代码来源:gui.py

示例8: __init__

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

        columns = ("#1", "#2", "#3")
        self.tree = ttk.Treeview(self, show="headings", columns=columns)
        self.tree.heading("#1", text="Last name")
        self.tree.heading("#2", text="First name")
        self.tree.heading("#3", text="Email")
        ysb = ttk.Scrollbar(self, orient=tk.VERTICAL, command=self.tree.yview)
        self.tree.configure(yscroll=ysb.set)

        with open("contacts.csv", newline="") as f:
            for contact in csv.reader(f):
                self.tree.insert("", tk.END, values=contact)
        self.tree.bind("<<TreeviewSelect>>", self.print_selection)

        self.tree.grid(row=0, column=0)
        ysb.grid(row=0, column=1, sticky=tk.N + tk.S)
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1) 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Application-Development-Cookbook,代码行数:23,代码来源:chapter8_03.py

示例9: __init__

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

示例10: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import S [as 别名]
def __init__(self):
        super().__init__()
        label_a = tk.Label(self, text="Label A", bg="yellow")
        label_b = tk.Label(self, text="Label B", bg="orange")
        label_c = tk.Label(self, text="Label C", bg="red")
        label_d = tk.Label(self, text="Label D", bg="green")
        label_e = tk.Label(self, text="Label E", bg="blue")

        label_a.place(relwidth=0.25, relheight=0.25)
        label_b.place(x=100, anchor=tk.N,
                      width=100, height=50)
        label_c.place(relx=0.5, rely=0.5, anchor=tk.CENTER,
                      relwidth=0.5, relheight=0.5)
        label_d.place(in_=label_c, anchor=tk.N + tk.W,
                      x=2, y=2, relx=0.5, rely=0.5,
                      relwidth=0.5, relheight=0.5)
        label_e.place(x=200, y=200, anchor=tk.S + tk.E,
                      relwidth=0.25, relheight=0.25) 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Application-Development-Cookbook,代码行数:20,代码来源:chapter2_04.py

示例11: create_layout

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import S [as 别名]
def create_layout(self):
        padWE = dict(sticky=(tk.W, tk.E), padx="0.5m", pady="0.5m")
        self.currencyFromCombobox.grid(row=0, column=0, **padWE)
        self.amountSpinbox.grid(row=0, column=1, **padWE)
        self.currencyToCombobox.grid(row=1, column=0, **padWE)
        self.resultLabel.grid(row=1, column=1, **padWE)
        self.grid(row=0, column=0, sticky=(tk.N, tk.S, tk.E, tk.W))
        self.columnconfigure(0, weight=2)
        self.columnconfigure(1, weight=1)
        self.master.columnconfigure(0, weight=1)
        self.master.rowconfigure(0, weight=1)
        self.master.minsize(150, 40) 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:14,代码来源:Main.py

示例12: create_file_menu

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import S [as 别名]
def create_file_menu(self):
        modifier = TkUtil.menu_modifier()
        self.fileMenu = tk.Menu(self.menubar, name="apple")
        self.fileMenu.add_command(label=NEW, underline=0,
                command=self.new, image=self.menuImages[NEW],
                compound=tk.LEFT, accelerator=modifier + "+N")
        self.fileMenu.add_command(label=OPEN + ELLIPSIS, underline=0,
                command=self.open, image=self.menuImages[OPEN],
                compound=tk.LEFT, accelerator=modifier + "+O")
        self.fileMenu.add_cascade(label=OPEN_RECENT,
                underline=5, image=self.menuImages[OPEN],
                compound=tk.LEFT)
        self.fileMenu.add_command(label=SAVE, underline=0,
                command=self.save, image=self.menuImages[SAVE],
                compound=tk.LEFT, accelerator=modifier + "+S")
        self.fileMenu.add_command(label=SAVE_AS + ELLIPSIS, underline=5,
                command=self.save_as, image=self.menuImages[SAVEAS],
                compound=tk.LEFT)
        if TkUtil.mac():
            self.master.createcommand("::tk::mac::ShowPreferences",
                    self.preferences)
            self.master.createcommand("exit", self.close)
        else:
            self.fileMenu.add_separator()
            self.fileMenu.add_command(label=PREFERENCES + ELLIPSIS,
                    underline=0, image=self.menuImages[PREFERENCES],
                    compound=tk.LEFT, command=self.preferences)
            self.fileMenu.add_separator()
            self.fileMenu.add_command(label=QUIT, underline=0,
                    command=self.close, compound=tk.LEFT,
                    image=self.menuImages[QUIT],
                    accelerator=modifier + "+Q")
        self.menubar.add_cascade(label="File", underline=0,
                menu=self.fileMenu)


    # NOTE: the Tkinter API doesn't seem to let us check whether redo is
    # possible (so here we always leave Redo enabled). 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:40,代码来源:Main.py

示例13: create_central_area

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import S [as 别名]
def create_central_area(self):
        self.editor = Editor.Editor(self.master,
                set_status_text=self.set_status_text,
                font=self.create_font(), maxundo=0, undo=True,
                wrap=tk.WORD)
        self.editor.grid(row=1, column=1, sticky=(tk.N, tk.S, tk.W, tk.E),
                padx=PAD, pady=PAD)
        self.editor.text.bind("<<Selection>>", self.on_selection)
        self.editor.text.bind("<<Modified>>", self.on_modified)
        self.editor.text.bind("<KeyRelease>", self.on_moved, "+")
        self.editor.text.bind("<ButtonRelease>", self.on_moved, "+")
        self.editor.text.focus() 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:14,代码来源:Main.py

示例14: create_ui

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import S [as 别名]
def create_ui(self):
        self.helpLabel = ttk.Label(self, text=_TEXT, background="white")
        self.closeButton = TkUtil.Button(self, text="Close", underline=0)
        self.helpLabel.pack(anchor=tk.N, expand=True, fill=tk.BOTH,
                padx=PAD, pady=PAD)
        self.closeButton.pack(anchor=tk.S)
        self.protocol("WM_DELETE_WINDOW", self.close)
        if not TkUtil.mac():
            self.bind("<Alt-c>", self.close)
        self.bind("<Escape>", self.close)
        self.bind("<Expose>", self.reposition) 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:13,代码来源:Help.py

示例15: create_dock_areas

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import S [as 别名]
def create_dock_areas(self):
        self.leftDockArea = ttk.Frame(self.master)
        self.rightDockArea = ttk.Frame(self.master)
        self.leftDockArea.grid(row=1, column=0, sticky=(tk.N, tk.S))
        self.leftDockArea.grid_remove()
        self.rightDockArea.grid(row=1, column=2, sticky=(tk.N, tk.S))
        self.rightDockArea.grid_remove() 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:9,代码来源:Main.py


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