Python tkinter.font 模块,BOLD 实例源码

我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用tkinter.font.BOLD

项目:stash-scanner    作者:senuido    | 项目源码 | 文件源码
def __init__(self, master, **kw):
        super().__init__(master)

        # self.grid_propagate(0)
        # self.columnconfigure(0, weight=1)
        # self.rowconfigure(0, weight=1)

        self.var = kw.get('variable', IntVar())
        kw['variable'] = self.var
        kw['from_'] = ConfidenceLevel.Low.value
        kw['to'] = ConfidenceLevel.VeryHigh.value
        # kw['command'] = self.scale_change
        kw['orient'] = HORIZONTAL

        self.lbl_scale = Label(self)
        self.scale = Scale(self, **kw)

        self.scale_font = tkfont.nametofont(Style().lookup('TLabel', 'font')).copy()
        self.scale_font.config(weight=tkfont.BOLD, size=9)
        self.lbl_scale.config(font=self.scale_font, width=3, anchor=CENTER)
        self.var.trace_variable('w', lambda a, b, c: self.scale_change())

        self.scale.grid(row=0, column=0, sticky='ns')
        self.lbl_scale.grid(row=0, column=1, sticky='ns', padx=(3, 0))
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def SetFontSample(self,event=None):
        fontName=self.fontName.get()
        if self.fontBold.get():
            fontWeight=tkFont.BOLD
        else:
            fontWeight=tkFont.NORMAL
        self.editFont.config(size=self.fontSize.get(),
                weight=fontWeight,family=fontName)
项目:stargateRL    作者:thee-engineer    | 项目源码 | 文件源码
def __init__(self, master, label):
        """Construct the sub frame."""
        tk.Frame.__init__(self, master, bg=SUBFRAME_COLORS[0])
        self.pack(side=tk.TOP, fill=tk.BOTH)
        self.options = {}

        header_font = tkFont.Font(family='Serif', size=18, weight=tkFont.BOLD)
        self._label = tk.Label(master=self, text='# '+ label, anchor=tk.NW,
                               padx=25, font=header_font,
                               bg=HEADER_COLORS[0], fg=HEADER_COLORS[1])
        self._label.pack(fill=tk.X)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def SetFontSample(self, event=None):
        fontName = self.fontName.get()
        fontWeight = tkFont.BOLD if self.fontBold.get() else tkFont.NORMAL
        newFont = (fontName, self.fontSize.get(), fontWeight)
        self.labelFontSample.config(font=newFont)
        self.textHighlightSample.configure(font=newFont)
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def SetFontSample(self, event=None):
        fontName = self.fontName.get()
        fontWeight = tkFont.BOLD if self.fontBold.get() else tkFont.NORMAL
        newFont = (fontName, self.fontSize.get(), fontWeight)
        self.labelFontSample.config(font=newFont)
        self.textHighlightSample.configure(font=newFont)
项目:Tkinter-By-Example    作者:Dvlv    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()

        self.inventory_slots = []
        self.inventory_slots_in_use = []
        self.current_screen_number = 0
        self.success_font = font.Font(family="ubuntu", size=50, weight=font.BOLD)

        self.title("Point and Click")
        self.geometry("800x640")
        self.resizable(False, False)

        self.key_image = tk.PhotoImage(file="assets/key.png")
        self.question_mark_image = tk.PhotoImage(file="assets/questionmark.png")

        self.screen = tk.Canvas(self, bg="white", width=500, height=800)
        self.right_frame = tk.Frame(self, width=300, height=800)
        self.right_frame.pack_propagate(0)

        self.help_var = tk.StringVar(self.right_frame)
        self.help_var.set("Try Clicking Something")

        self.help_box = tk.Label(self.right_frame, textvar=self.help_var, background="black", foreground="white", padx=10, pady=20)
        self.help_box.pack(side=tk.TOP, fill=tk.X, padx=10, pady=10)

        inventory_title = tk.Label(self.right_frame, text="Inventory:", background="grey", foreground="white")

        inventory_space = tk.Frame(self.right_frame, background="lightgrey", width=300, height=320)
        inventory_space.pack_propagate(0)

        inventory_space.pack(side=tk.BOTTOM)
        inventory_title.pack(side=tk.BOTTOM, fill=tk.X)

        inventory_slot_1 = tk.Button(inventory_space, image=self.question_mark_image, width=50, height=50)
        inventory_slot_2 = tk.Button(inventory_space, image=self.question_mark_image, width=50, height=50)
        inventory_slot_3 = tk.Button(inventory_space, image=self.question_mark_image, width=50, height=50)

        inventory_slot_1.pack(pady=(40,20), padx=20)
        inventory_slot_2.pack(pady=20, padx=20)
        inventory_slot_3.pack(pady=(20,0), padx=20)

        self.inventory_slots.append(inventory_slot_1)
        self.inventory_slots.append(inventory_slot_2)
        self.inventory_slots.append(inventory_slot_3)

        self.right_frame.pack(side=tk.RIGHT)
        self.screen.pack(side=tk.LEFT)

        self.screen.bind("<Button-1>", self.handle_click)