日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python fonttool_Python wx.Font方法代码示例

發布時間:2025/3/13 python 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python fonttool_Python wx.Font方法代码示例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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

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

示例1: save

?點贊 6

?

# 需要導入模塊: 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,

示例2: ComputeFontScale

?點贊 6

?

# 需要導入模塊: 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,

示例3: _Draw

?點贊 6

?

# 需要導入模塊: 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,

示例4: __init__

?點贊 6

?

# 需要導入模塊: 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,

示例5: draw_monitor_numbers

?點贊 6

?

# 需要導入模塊: 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,

示例6: draw_monitor_sizes

?點贊 6

?

# 需要導入模塊: 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,

示例7: __init__

?點贊 6

?

# 需要導入模塊: 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,

示例8: __init__

?點贊 6

?

# 需要導入模塊: 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,

示例9: __init__

?點贊 6

?

# 需要導入模塊: 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,

示例10: __do_layout

?點贊 6

?

# 需要導入模塊: 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,

示例11: set_font_style

?點贊 5

?

# 需要導入模塊: 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,

示例12: make_bold

?點贊 5

?

# 需要導入模塊: 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,

示例13: h0

?點贊 5

?

# 需要導入模塊: 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,

示例14: _header

?點贊 5

?

# 需要導入模塊: 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,

示例15: getTextWidth

?點贊 5

?

# 需要導入模塊: 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,

示例16: createPixelFont

?點贊 5

?

# 需要導入模塊: import wx [as 別名]

# 或者: from wx import Font [as 別名]

def createPixelFont(height, family, style, weight):

fs = 6

selected = fs

closest = 1000

over = 0

# FIXME: what's this "keep trying even once we go over the max height"

# stuff? get rid of it.

while 1:

fn = wx.Font(fs, family, style, weight,

encoding = wx.FONTENCODING_ISO8859_1)

h = getFontHeight(fn)

diff = height -h

if diff >= 0:

if diff < closest:

closest = diff

selected = fs

else:

over += 1

if (over >= 3) or (fs > 144):

break

fs += 2

return wx.Font(selected, family, style, weight,

encoding = wx.FONTENCODING_ISO8859_1)

開發者ID:trelby,項目名稱:trelby,代碼行數:31,

示例17: load

?點贊 5

?

# 需要導入模塊: import wx [as 別名]

# 或者: from wx import Font [as 別名]

def load(self, s):

vals = self.cvars.makeVals(s)

self.cvars.load(vals, "", self)

for t in self.types.itervalues():

t.load(vals, "Element/")

for pf in self.pdfFonts.itervalues():

pf.load(vals, "Font/")

self.recalc()

# save config into a string and return that.

開發者ID:trelby,項目名稱:trelby,代碼行數:16,

示例18: __init__

?點贊 5

?

# 需要導入模塊: import wx [as 別名]

# 或者: from wx import Font [as 別名]

def __init__(self):

wx.Dialog.__init__(self, None, title=_('Standalone tool'), size=(130,230))

self.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))

panel = wx.Panel(self)

self.settings_b = wx.Button(panel,label=_('settings') , pos=(20, 20))

self.start_b = wx.Button(panel, label=_('start'), pos=(20, 60))

self.stop_b = wx.Button(panel, label=_('stop'), pos=(20, 100))

self.cancel_b = wx.Button(panel, label=_('cancel'), pos=(20, 140))

self.Bind(wx.EVT_BUTTON, self.on_Button)

開發者ID:sailoog,項目名稱:openplotter,代碼行數:14,

示例19: __init__

?點贊 5

?

# 需要導入模塊: import wx [as 別名]

# 或者: from wx import Font [as 別名]

def __init__(self):

self.ButtonNr = 1

wx.Dialog.__init__(self, None, title=_('Add individual name to serial port'), size=(130, 230))

self.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))

panel = wx.Panel(self)

self.settings_b = wx.Button(panel, label=_('settings'), pos=(20, 20))

self.start_b = wx.Button(panel, label=_('start'), pos=(20, 60))

self.stop_b = wx.Button(panel, label=_('stop'), pos=(20, 100))

self.cancel_b = wx.Button(panel, label=_('cancel'), pos=(20, 140))

self.Bind(wx.EVT_BUTTON, self.on_Button)

開發者ID:sailoog,項目名稱:openplotter,代碼行數:14,

示例20: __init__

?點贊 5

?

# 需要導入模塊: import wx [as 別名]

# 或者: from wx import Font [as 別名]

def __init__(self):

self.option=sys.argv[1]

self.text_sms=sys.argv[2]

self.text_sms=unicode(self.text_sms,'utf-8')

self.phone=sys.argv[3]

self.conf = Conf()

self.home = self.conf.home

self.currentpath = self.home+self.conf.get('GENERAL', 'op_folder')+'/openplotter'

Language(self.conf)

wx.Frame.__init__(self, None, title=_('Test SMS'), size=(500,260))

self.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))

self.icon = wx.Icon(self.currentpath+'/openplotter.ico', wx.BITMAP_TYPE_ICO)

self.SetIcon(self.icon)

self.CreateStatusBar()

self.text=wx.StaticText(self, label=_('Error'), pos=(10, 10))

self.output = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_DONTWRAP, size=(480,110), pos=(10,50))

self.button_close =wx.Button(self, label=_('Close'), pos=(300, 170))

self.Bind(wx.EVT_BUTTON, self.close, self.button_close)

self.button_calculate =wx.Button(self, label=_('Start'), pos=(400, 170))

self.Bind(wx.EVT_BUTTON, self.calculate, self.button_calculate)

if self.option=='i':

self.text.SetLabel(_('Press start to check the settings and connect to the GSM device'))

if self.option=='t':

self.text.SetLabel(_('Press start to send the text "').decode('utf8')+self.text_sms+_('"\nto the number "').decode('utf8')+self.phone+'"')

self.Centre()

開發者ID:sailoog,項目名稱:openplotter,代碼行數:41,

示例21: SetFont

?點贊 5

?

# 需要導入模塊: import wx [as 別名]

# 或者: from wx import Font [as 別名]

def SetFont(self, Size, Family, Style, Weight, Underlined, FaceName):

self.Font = self.FontList.setdefault( (Size,

Family,

Style,

Weight,

Underlined,

FaceName),

#wx.FontFromPixelSize((0.45*Size,Size), # this seemed to give a decent height/width ratio on Windows

wx.Font(Size,

Family,

Style,

Weight,

Underlined,

FaceName) )

開發者ID:dougthor42,項目名稱:wafer_map,代碼行數:16,

示例22: CalcBoundingBox

?點贊 5

?

# 需要導入模塊: import wx [as 別名]

# 或者: from wx import Font [as 別名]

def CalcBoundingBox(self):

## this isn't exact, as fonts don't scale exactly.

dc = wx.MemoryDC()

bitmap = wx.Bitmap(1, 1)

dc.SelectObject(bitmap) #wxMac needs a Bitmap selected for GetTextExtent to work.

DrawingSize = 40 # pts This effectively determines the resolution that the BB is computed to.

ScaleFactor = float(self.Size) / DrawingSize

self.SetFont(DrawingSize, self.Family, self.Style, self.Weight, self.Underlined, self.FaceName)

dc.SetFont(self.Font)

(w,h) = dc.GetTextExtent(self.String)

w = w * ScaleFactor

h = h * ScaleFactor

x, y = self.ShiftFun(self.XY[0], self.XY[1], w, h, world = 1)

self.BoundingBox = BBox.asBBox(((x, y-h ),(x + w, y)))

開發者ID:dougthor42,項目名稱:wafer_map,代碼行數:16,

示例23: WrapToWidth

?點贊 5

?

# 需要導入模塊: import wx [as 別名]

# 或者: from wx import Font [as 別名]

def WrapToWidth(self):

dc = wx.MemoryDC()

bitmap = wx.Bitmap(1, 1)

dc.SelectObject(bitmap) #wxMac needs a Bitmap selected for GetTextExtent to work.

DrawingSize = self.LayoutFontSize # pts This effectively determines the resolution that the BB is computed to.

ScaleFactor = float(self.Size) / DrawingSize

Width = (self.Width - 2*self.PadSize) / ScaleFactor #Width to wrap to

self.SetFont(DrawingSize, self.Family, self.Style, self.Weight, self.Underlined, self.FaceName)

dc.SetFont(self.Font)

NewStrings = []

for s in self.Strings:

#beginning = True

text = s.split(" ")

text.reverse()

LineLength = 0

NewText = text[-1]

del text[-1]

while text:

w = dc.GetTextExtent(' ' + text[-1])[0]

if LineLength + w <= Width:

NewText += ' '

NewText += text[-1]

LineLength = dc.GetTextExtent(NewText)[0]

else:

NewStrings.append(NewText)

NewText = text[-1]

LineLength = dc.GetTextExtent(text[-1])[0]

del text[-1]

NewStrings.append(NewText)

self.Strings = NewStrings

開發者ID:dougthor42,項目名稱:wafer_map,代碼行數:32,

示例24: _Draw

?點贊 5

?

# 需要導入模塊: import wx [as 別名]

# 或者: from wx import Font [as 別名]

def _Draw(self, dc, Canvas):

"""

_Draw method for Overlay.

.. note::

This is a differeent signarture than the DrawObject Draw

"""

dc.SetFont(self.Font)

dc.SetTextForeground(self.Color)

if self.BackgroundColor:

dc.SetBackgroundMode(wx.SOLID)

dc.SetTextBackground(self.BackgroundColor)

else:

dc.SetBackgroundMode(wx.TRANSPARENT)

dc.DrawTextPoint(self.String, self.XY)

開發者ID:dougthor42,項目名稱:wafer_map,代碼行數:17,

示例25: get_wx_font

?點贊 5

?

# 需要導入模塊: import wx [as 別名]

# 或者: from wx import Font [as 別名]

def get_wx_font(self, s, prop):

"""

Return a wx font. Cache instances in a font dictionary for

efficiency

"""

DEBUG_MSG("get_wx_font()", 1, self)

key = hash(prop)

fontprop = prop

fontname = fontprop.get_name()

font = self.fontd.get(key)

if font is not None:

return font

# Allow use of platform independent and dependent font names

wxFontname = self.fontnames.get(fontname, wx.ROMAN)

wxFacename = '' # Empty => wxPython chooses based on wx_fontname

# Font colour is determined by the active wx.Pen

# TODO: It may be wise to cache font information

size = self.points_to_pixels(fontprop.get_size_in_points())

font =wx.Font(int(size+0.5), # Size

wxFontname, # 'Generic' name

self.fontangles[fontprop.get_style()], # Angle

self.fontweights[fontprop.get_weight()], # Weight

False, # Underline

wxFacename) # Platform font name

# cache the font and gc and return it

self.fontd[key] = font

return font

開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:38,

示例26: get_wx_font

?點贊 5

?

# 需要導入模塊: import wx [as 別名]

# 或者: from wx import Font [as 別名]

def get_wx_font(self, s, prop):

"""

Return a wx font. Cache instances in a font dictionary for

efficiency

"""

DEBUG_MSG("get_wx_font()", 1, self)

key = hash(prop)

fontprop = prop

fontname = fontprop.get_name()

font = self.fontd.get(key)

if font is not None:

return font

# Allow use of platform independent and dependent font names

wxFontname = self.fontnames.get(fontname, wx.ROMAN)

wxFacename = '' # Empty => wxPython chooses based on wx_fontname

# Font colour is determined by the active wx.Pen

# TODO: It may be wise to cache font information

size = self.points_to_pixels(fontprop.get_size_in_points())

font = wx.Font(int(size + 0.5), # Size

wxFontname, # 'Generic' name

self.fontangles[fontprop.get_style()], # Angle

self.fontweights[fontprop.get_weight()], # Weight

False, # Underline

wxFacename) # Platform font name

# cache the font and gc and return it

self.fontd[key] = font

return font

開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:36,

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

總結

以上是生活随笔為你收集整理的python fonttool_Python wx.Font方法代码示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。