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


Python tkinter.W属性代码示例

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


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

示例1: load_friends

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import W [as 别名]
def load_friends(self):
        all_users = self.requester.get_all_users()

        for user in all_users:
            if user['username'] != self.username:
                friend_frame = ttk.Frame(self.canvas_frame)

                profile_photo = tk.PhotoImage(file="images/avatar.png")
                profile_photo_label = ttk.Label(friend_frame, image=profile_photo)
                profile_photo_label.image = profile_photo

                friend_name = ttk.Label(friend_frame, text=user['real_name'], anchor=tk.W)

                message_this_friend = partial(self.open_chat_window, username=user["username"], real_name=user["real_name"])

                message_button = ttk.Button(friend_frame, text="Chat", command=message_this_friend)

                profile_photo_label.pack(side=tk.LEFT)
                friend_name.pack(side=tk.LEFT)
                message_button.pack(side=tk.RIGHT)

                friend_frame.pack(fill=tk.X, expand=1) 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Programming-by-Example,代码行数:24,代码来源:friendslist.py

示例2: load_friends

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import W [as 别名]
def load_friends(self):
        friend_frame = ttk.Frame(self.canvas_frame)

        profile_photo = tk.PhotoImage(file="images/avatar.png")
        profile_photo_label = ttk.Label(friend_frame, image=profile_photo)
        profile_photo_label.image = profile_photo

        friend_name = ttk.Label(friend_frame, text="Jaden Corebyn", anchor=tk.W)

        message_button = ttk.Button(friend_frame, text="Chat", command=self.open_chat_window)

        profile_photo_label.pack(side=tk.LEFT)
        friend_name.pack(side=tk.LEFT)
        message_button.pack(side=tk.RIGHT)

        friend_frame.pack(fill=tk.X, expand=1) 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Programming-by-Example,代码行数:18,代码来源:friendslist.py

示例3: build

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import W [as 别名]
def build(self, property_dict):
        for c in self.interior.winfo_children():
            c.destroy()


        # Filter property dict
        property_dict = {k: v for k, v in property_dict.items()
                         if self._key_filter_function(k)}

        # Prettify key/value pairs for display
        property_dict = {self._make_key_pretty(k): self._make_value_pretty(v)
                            for k, v in property_dict.items()}

        # Sort by key and filter
        dict_values = sorted(property_dict.items(), key=lambda x: x[0])

        for n,(k,v) in enumerate(dict_values):
            tk.Label(self.interior, text=k, borderwidth=1, relief=tk.SOLID,
                wraplength=75, anchor=tk.E, justify=tk.RIGHT).grid(
                row=n, column=0, sticky='nesw', padx=1, pady=1, ipadx=1)
            tk.Label(self.interior, text=v, borderwidth=1,
                wraplength=125, anchor=tk.W, justify=tk.LEFT).grid(
                row=n, column=1, sticky='nesw', padx=1, pady=1, ipadx=1) 
开发者ID:jsexauer,项目名称:networkx_viewer,代码行数:25,代码来源:viewer.py

示例4: create_layout

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import W [as 别名]
def create_layout(self):
        pad = dict(padx=PAD, pady=PAD)
        padWE = dict(sticky=(tk.W, tk.E), **pad)
        self.findLabel.grid(row=0, column=0, sticky=tk.W, **pad)
        self.findEntry.grid(row=0, column=1, **padWE)
        self.replaceLabel.grid(row=1, column=0, sticky=tk.W, **pad)
        self.replaceEntry.grid(row=1, column=1, **padWE)
        self.caseSensitiveCheckbutton.grid(row=2, column=0, columnspan=2,
                **padWE)
        self.wholeWordsCheckbutton.grid(row=3, column=0, columnspan=2,
                **padWE)
        self.findButton.grid(row=0, column=2, **padWE)
        self.replaceButton.grid(row=1, column=2, **padWE)
        self.closeButton.grid(row=2, column=2, **padWE)
        self.extendButton.grid(row=3, column=2, **padWE)
        self.grid_columnconfigure(1, weight=1)
        self.minsize(180, 90)
        self.maxsize(600, 150)
        self.geometry("+{}+{}".format(self.master.winfo_rootx() + 200,
                self.master.winfo_rooty() - 30)) 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:22,代码来源:Find.py

示例5: create_statusbar

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

示例6: layout_widgets

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import W [as 别名]
def layout_widgets(self):
        pad = dict(padx=PAD, pady=PAD)
        padWE = dict(sticky=(tk.W, tk.E), **pad)
        self.sourceLabel.grid(row=0, column=0, sticky=tk.W, **pad)
        self.sourceEntry.grid(row=0, column=1, columnspan=3, **padWE)
        self.sourceButton.grid(row=0, column=4, **pad)
        self.targetLabel.grid(row=1, column=0, sticky=tk.W, **pad)
        self.targetEntry.grid(row=1, column=1, columnspan=3, **padWE)
        self.targetButton.grid(row=1, column=4, **pad)
        self.dimensionLabel.grid(row=2, column=0, sticky=tk.W, **pad)
        self.dimensionCombobox.grid(row=2, column=1, **padWE)
        self.helpButton.grid(row=2, column=3, **pad)
        self.scaleButton.grid(row=2, column=4, **pad)
        self.aboutButton.grid(row=3, column=3, **pad)
        self.quitButton.grid(row=3, column=4, **pad)
        self.statusLabel.grid(row=3, column=0, columnspan=3, **padWE)
        self.grid() 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:19,代码来源:Main.py

示例7: create_window

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

示例8: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import W [as 别名]
def __init__(self, parent, label='', input_class=ttk.Entry,
                 input_var=None, input_args=None, label_args=None,
                 **kwargs):
        super().__init__(parent, **kwargs)
        input_args = input_args or {}
        label_args = label_args or {}
        self.variable = input_var

        if input_class in (ttk.Checkbutton, ttk.Button, ttk.Radiobutton):
            input_args["text"] = label
            input_args["variable"] = input_var
        else:
            self.label = ttk.Label(self, text=label, **label_args)
            self.label.grid(row=0, column=0, sticky=(tk.W + tk.E))
            input_args["textvariable"] = input_var

        self.input = input_class(self, **input_args)
        self.input.grid(row=1, column=0, sticky=(tk.W + tk.E))
        self.columnconfigure(0, weight=1)
        self.error = getattr(self.input, 'error', tk.StringVar())
        self.error_label = ttk.Label(self, textvariable=self.error)
        self.error_label.grid(row=2, column=0, sticky=(tk.W + tk.E)) 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-with-Tkinter,代码行数:24,代码来源:data_entry_app.py

示例9: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import W [as 别名]
def __init__(self, parent, label='', input_class=ttk.Entry,
                 input_var=None, input_args=None, label_args=None,
                 **kwargs):
        super().__init__(parent, **kwargs)
        input_args = input_args or {}
        label_args = label_args or {}
        self.variable = input_var

        if input_class in (ttk.Checkbutton, ttk.Button, ttk.Radiobutton):
            input_args["text"] = label
            input_args["variable"] = input_var
        else:
            self.label = ttk.Label(self, text=label, **label_args)
            self.label.grid(row=0, column=0, sticky=(tk.W + tk.E))
            input_args["textvariable"] = input_var

        self.input = input_class(self, **input_args)
        self.input.grid(row=1, column=0, sticky=(tk.W + tk.E))
        self.columnconfigure(0, weight=1) 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-with-Tkinter,代码行数:21,代码来源:data_entry_app.py

示例10: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import W [as 别名]
def __init__(self, parent, *args, **kwargs):
        super().__init__(parent, *args, **kwargs)

        self.name = tk.StringVar()
        self.hello_string = tk.StringVar()
        self.hello_string.set("Hello World")

        name_label = ttk.Label(self, text="Name:")
        name_entry = ttk.Entry(self, textvariable=self.name)
        ch_button = ttk.Button(self, text="Change", command=self.on_change)
        hello_label = ttk.Label(self, textvariable=self.hello_string,
            font=("TkDefaultFont", 64), wraplength=600)

        # Layout form
        name_label.grid(row=0, column=0, sticky=tk.W)
        name_entry.grid(row=0, column=1, sticky=(tk.W + tk.E))
        ch_button.grid(row=0, column=2, sticky=tk.E)
        hello_label.grid(row=1, column=0, columnspan=3)
        self.columnconfigure(1, weight=1) 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-with-Tkinter,代码行数:21,代码来源:better_hello_tkinter.py

示例11: configure_canvas

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

示例12: configure_treeview

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

示例13: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import W [as 别名]
def __init__(self, master):
        Frame.__init__(self, master)
        self.config(border=1)

        self.msg = Label(self, bd=1, relief=SUNKEN, anchor=W)
        self.msg.pack(side='left', expand=True, fill=X)

        self.column = Label(self, bd=1, relief=SUNKEN, anchor=W)
        self.column.config(text='Col: 0')
        self.column.pack(side='right', fill=X)

        self.line = Label(self, bd=1, relief=SUNKEN, anchor=W)
        self.line.config(text='Line: 1')
        self.line.pack(side='right', fill=X)


        self.mode = Label(self, bd=1, relief=SUNKEN, anchor=W)
        self.mode.config(text='Mode: 1')
        self.mode.pack(side='right', fill=X) 
开发者ID:vyapp,项目名称:vy,代码行数:21,代码来源:statusbar.py

示例14: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import W [as 别名]
def __init__(self, parent, isRunning):
        super().__init__(parent)
        self.parent = parent
        self.pack()
        self.state = DayState()
        self.isRunning = isRunning

        self.textClock = tkinter.Label(self, width=60, text="现在时间是00:00", anchor=tkinter.W)
        self.textScreen = ScrolledText(self, height=10, width=60, state="disable")
        self.buttonUse = tkinter.Button(self, text="使用金库")
        self.buttonAlarm = tkinter.Button(self, text="按下警铃")
        self.buttonPhone = tkinter.Button(self, text="正常通话")
        self.buttonExit = tkinter.Button(self, text="结束", command=self.quit)

        self.textClock.grid(row=0, columnspan=6, padx=2, pady=2, sticky=tkinter.EW)
        self.textScreen.grid(row=1, columnspan=6, padx=2, pady=2, sticky=tkinter.EW)
        self.buttonUse.grid(row=2, column=1, padx=2, pady=2, sticky=tkinter.EW)
        self.buttonAlarm.grid(row=2, column=2, padx=2, pady=2, sticky=tkinter.EW)
        self.buttonPhone.grid(row=2, column=3, padx=2, pady=2, sticky=tkinter.EW)
        self.buttonExit.grid(row=2, column=4, padx=2, pady=2, sticky=tkinter.EW)

        self.buttonUse.bind("<Button-1>", self.useEvent)
        self.buttonAlarm.bind("<Button-1>", self.useAlarm)
        self.buttonPhone.bind("<Button-1>", self.usePhone) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:26,代码来源:SafeFrame.py

示例15: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import W [as 别名]
def __init__(self, parent):
        super().__init__(parent)
        self.parent = parent
        self.pack()

        self.checkValue = tkinter.StringVar()

        self.createColleagues()

        self.checkGuest.grid(row=0, column=0, padx=2, pady=2, sticky=tkinter.W)
        self.checkLogin.grid(row=0, column=1, padx=2, pady=2, sticky=tkinter.EW)
        self.usernameLabel.grid(row=1, column=0, padx=2, pady=2, sticky=tkinter.W)
        self.textUser.grid(row=1, column=1, padx=2, pady=2, sticky=tkinter.EW)
        self.passwordLabel.grid(row=2, column=0, padx=2, pady=2, sticky=tkinter.W)
        self.textPassword.grid(row=2, column=1, padx=2, pady=2, sticky=tkinter.EW)
        self.buttonOk.grid(row=3, column=0, padx=2, pady=2, sticky=tkinter.EW)
        self.buttonCancel.grid(row=3, column=1, padx=2, pady=2, sticky=tkinter.EW)

        self.checkGuest.focus_set()

        self.checkGuest.bind("<Button-1>", self.colleagueChanged)
        self.checkLogin.bind("<Button-1>", self.colleagueChanged)

        self.textUser.bind("<Key>", self.colleagueChanged)
        self.textPassword.bind("<Key>", self.colleagueChanged) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:27,代码来源:LoginFrame.py


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