當前位置: 首頁>>代碼示例>>Python>>正文


Python wx.Font方法代碼示例

本文整理匯總了Python中wx.Font方法的典型用法代碼示例。如果您正苦於以下問題:Python wx.Font方法的具體用法?Python wx.Font怎麽用?Python wx.Font使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在wx的用法示例。


在下文中一共展示了wx.Font方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: save

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def save(self):
        s = self.cvars.save("", self)

        for t in self.types.itervalues():
            s += t.save("Element/")

        for pf in self.pdfFonts.itervalues():
            s += pf.save("Font/")

        return s

    # fix up all invalid config values and recalculate all variables
    # dependent on other variables.
    #
    # if doAll is False, enforces restrictions only on a per-variable
    # basis, e.g. doesn't modify variable v2 based on v1's value. this is
    # useful when user is interactively modifying v1, and it temporarily
    # strays out of bounds (e.g. when deleting the old text in an entry
    # box, thus getting the minimum value), which would then possibly
    # modify the value of other variables which is not what we want. 
開發者ID:trelby,項目名稱:trelby,代碼行數:22,代碼來源:config.py

示例2: ComputeFontScale

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def ComputeFontScale():
    """
    Compute the font scale.
    
    A global variable to hold the scaling from pixel size to point size.
    """
    global FontScale
    dc = wx.ScreenDC()
    dc.SetFont(wx.Font(16, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
    E = dc.GetTextExtent("X")
    FontScale = 16/E[1]
    del dc

# why do we do this here, causes a Sphinx build crash
#ComputeFontScale()    

## fixme: This should probably be re-factored into a class 
開發者ID:dougthor42,項目名稱:wafer_map,代碼行數:19,代碼來源:FCObjects.py

示例3: _Draw

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def _Draw(self, dc , WorldToPixel, ScaleWorldToPixel, HTdc=None):
        XY = WorldToPixel(self.XY)
        dc.SetFont(self.Font)
        dc.SetTextForeground(self.Color)
        if self.BackgroundColor:
            dc.SetBackgroundMode(wx.SOLID)
            dc.SetTextBackground(self.BackgroundColor)
        else:
            dc.SetBackgroundMode(wx.TRANSPARENT)
        if self.TextWidth is None or self.TextHeight is None:
            (self.TextWidth, self.TextHeight) = dc.GetTextExtent(self.String)
        XY = self.ShiftFun(XY[0], XY[1], self.TextWidth, self.TextHeight)
        dc.DrawText(self.String, XY)
        if HTdc and self.HitAble:
            HTdc.SetPen(self.HitPen)
            HTdc.SetBrush(self.HitBrush)
            HTdc.DrawRectangle(XY, (self.TextWidth, self.TextHeight) ) 
開發者ID:dougthor42,項目名稱:wafer_map,代碼行數:19,代碼來源:FCObjects.py

示例4: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def __init__(self,
                 String,
                 xy,
                 Size=24,
                 Color="Black",
                 BackgroundColor=None,
                 Family=wx.MODERN,
                 Style=wx.NORMAL,
                 Weight=wx.NORMAL,
                 Underlined=False,
                 Font=None):
        FloatCanvas.Text.__init__(self,
                                  String,
                                  xy,
                                  Size=Size,
                                  Color=Color,
                                  BackgroundColor=BackgroundColor,
                                  Family=Family,
                                  Style=Style,
                                  Weight=Weight,
                                  Underlined=Underlined,
                                  Font=Font) 
開發者ID:dougthor42,項目名稱:wafer_map,代碼行數:24,代碼來源:wm_legend.py

示例5: draw_monitor_numbers

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def draw_monitor_numbers(self, use_ppi_px):
        font = wx.Font(24, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
        font_clr = wx.Colour(60, 60, 60, alpha=wx.ALPHA_OPAQUE)

        for st_bmp in self.preview_img_list:
            bmp = st_bmp.GetBitmap()
            dc = wx.MemoryDC(bmp)
            text = str(self.preview_img_list.index(st_bmp))
            dc.SetTextForeground(font_clr)
            dc.SetFont(font)
            dc.DrawText(text, 5, 5)
            del dc
            st_bmp.SetBitmap(bmp)

        if use_ppi_px:
            self.draw_monitor_sizes() 
開發者ID:hhannine,項目名稱:superpaper,代碼行數:18,代碼來源:gui.py

示例6: draw_monitor_sizes

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def draw_monitor_sizes(self):
        font = wx.Font(24, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_LIGHT)
        font_clr = wx.Colour(60, 60, 60, alpha=wx.ALPHA_OPAQUE)

        for st_bmp, img_sz, dsp in zip(self.preview_img_list,
                                       self.img_rel_sizes,
                                       self.display_sys.disp_list):
            bmp = st_bmp.GetBitmap()
            dc = wx.MemoryDC(bmp)
            text = str(dsp.diagonal_size()[1]) + '"'
            dc.SetTextForeground(font_clr)
            dc.SetFont(font)
            # bmp_w, bmp_h = dc.GetSize()
            bmp_w, bmp_h = img_sz
            text_w, text_h = dc.GetTextExtent(text)
            pos_w = bmp_w - text_w - 5
            pos_h = 5
            dc.DrawText(text, pos_w, pos_h)
            del dc
            st_bmp.SetBitmap(bmp) 
開發者ID:hhannine,項目名稱:superpaper,代碼行數:22,代碼來源:gui.py

示例7: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def __init__(self, *args, **kwds):
        # begin wxGlade: DebugPanel.__init__
        kwds["style"] = kwds.get("style", 0) | wx.TAB_TRAVERSAL
        wx.Panel.__init__(self, *args, **kwds)
        self.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, 0, ""))

        sizer_2 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "sizer_2"), wx.VERTICAL)

        sizer_2.Add((0, 0), 0, 0, 0)

        self.SetSizer(sizer_2)

        self.Layout()
        # end wxGlade

# end of class DebugPanel 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:18,代碼來源:PanelClass.py

示例8: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetTitle(_("MyFrame"))

        sizer_1 = wx.BoxSizer(wx.VERTICAL)

        self.label_1 = wx.StaticText(self, wx.ID_ANY, _("Extraproperty example"))
        self.label_1.SetFont(wx.Font(40, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.label_1.SetFoobar(1)
        sizer_1.Add(self.label_1, 1, wx.ALL, 5)

        self.SetSizer(sizer_1)
        sizer_1.Fit(self)

        self.Layout()
        # end wxGlade

# end of class MyFrame 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:22,代碼來源:bug163.py

示例9: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def __init__(self, parent):
        wx.PyWindow.__init__(self, parent)
        self.font = wx.Font(
            40, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_ITALIC, wx.FONTWEIGHT_BOLD
        )
        self.SetBackgroundColour((255, 255, 255))
        self.logo1 = GetInternalBitmap("opensource-55x48")
        self.logo2 = GetInternalBitmap("python-powered")
        self.logo3 = GetInternalBitmap("logo2")
        self.image = GetInternalImage("logo")
        self.bmpWidth = self.image.GetWidth()
        self.bmpHeight = self.image.GetHeight()
        self.time = clock()
        self.count = 0
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_TIMER, self.UpdateDrawing)
        self.OnSize(None)
        self.timer = wx.Timer(self)
        self.timer.Start(10) 
開發者ID:EventGhost,項目名稱:EventGhost,代碼行數:21,代碼來源:AnimatedWindow.py

示例10: __do_layout

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def __do_layout(self):
        # begin wxGlade: About.__do_layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_3 = wx.BoxSizer(wx.VERTICAL)
        sizer_3.Add(self.bitmap_button_1, 1, 0, 0)
        self.meerk40t_about_version_text.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "Segoe UI"))
        sizer_3.Add(self.meerk40t_about_version_text, 0, 0, 0)
        sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
        meerk40t_about_text_header = wx.StaticText(self, wx.ID_ANY, "MeerK40t is a free MIT Licensed open source project for lasering on K40 Devices.\n\nParticipation in the project is highly encouraged. Past participation, and continuing participation is graciously thanked. This program is mostly the brainchild of Tatarize, who sincerely hopes his contributions will be but the barest trickle that becomes a raging river.")
        meerk40t_about_text_header.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "Segoe UI"))
        sizer_2.Add(meerk40t_about_text_header, 2, wx.EXPAND, 0)
        sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
        meerk40t_about_text = wx.StaticText(self, wx.ID_ANY, "Thanks.\nLi Huiyu for their controller. \nScorch for lighting our path.\nAlois Zingl for his wonderful Bresenham plotting algorithms.\n@joerlane and all the MeerKittens, past and present, great and small.\n\nIcon8 for their great icons ( https://icons8.com/ ) used throughout the project.\nThe works of countless developers who made everything possible.\nRegebro for his svg.path module.\nThe SVG Working Group.\nHackers (in the general sense).")
        meerk40t_about_text.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "Segoe UI"))
        sizer_1.Add(meerk40t_about_text, 2, wx.EXPAND, 0)
        self.SetSizer(sizer_1)
        self.Layout()
        self.Centre()
        # end wxGlade 
開發者ID:meerk40t,項目名稱:meerk40t,代碼行數:22,代碼來源:About.py

示例11: set_font_style

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def set_font_style(self, style):
    pointsize = self.cmd_textbox.GetFont().GetPointSize()
    font = wx.Font(pointsize, style,
                 wx.FONTWEIGHT_NORMAL, wx.FONTWEIGHT_BOLD, False)
    self.cmd_textbox.SetFont(font) 
開發者ID:ME-ICA,項目名稱:me-ica,代碼行數:7,代碼來源:runtime_display_panel.py

示例12: make_bold

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def make_bold(statictext):
  pointsize = statictext.GetFont().GetPointSize()
  font = wx.Font(pointsize, wx.FONTFAMILY_DEFAULT,
                 wx.FONTWEIGHT_NORMAL, wx.FONTWEIGHT_BOLD, False)
  statictext.SetFont(font) 
開發者ID:ME-ICA,項目名稱:me-ica,代碼行數:7,代碼來源:wx_util.py

示例13: h0

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def h0(parent, label):
  text = wx.StaticText(parent, label=label)
  font_size = text.GetFont().GetPointSize()
  font = wx.Font(font_size * 1.4, *(wx.FONTFAMILY_DEFAULT, wx.FONTWEIGHT_NORMAL, wx.FONTWEIGHT_BOLD, False))
  text.SetFont(font)
  return text 
開發者ID:ME-ICA,項目名稱:me-ica,代碼行數:8,代碼來源:wx_util.py

示例14: _header

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def _header(parent, label, styles):
  text = wx.StaticText(parent, label=label)
  font_size = text.GetFont().GetPointSize()
  font = wx.Font(font_size * 1.2, *styles)
  text.SetFont(font)
  return text 
開發者ID:ME-ICA,項目名稱:me-ica,代碼行數:8,代碼來源:wx_util.py

示例15: getTextWidth

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import Font [as 別名]
def getTextWidth(text, style, size):
    return (fontinfo.getMetrics(style).getTextWidth(text, size) / 72.0) * 25.4

# create a font that's height is at most 'height' pixels. other parameters
# are the same as in wx.Font's constructor. 
開發者ID:trelby,項目名稱:trelby,代碼行數:7,代碼來源:util.py


注:本文中的wx.Font方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。