當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。