本文整理匯總了Python中AppKit.NSFont.systemFontSize方法的典型用法代碼示例。如果您正苦於以下問題:Python NSFont.systemFontSize方法的具體用法?Python NSFont.systemFontSize怎麽用?Python NSFont.systemFontSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AppKit.NSFont
的用法示例。
在下文中一共展示了NSFont.systemFontSize方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from AppKit import NSFont [as 別名]
# 或者: from AppKit.NSFont import systemFontSize [as 別名]
def __init__(self, dimensions, font):
font_name = font.info.familyName
attribution = "{} by {}".format(font_name, font.info.designer)
attribution_attributes = {
NSFontAttributeName: NSFont.systemFontOfSize_(NSFont.systemFontSize()),
NSForegroundColorAttributeName: NSColor.whiteColor()
}
formatted_attribution = NSMutableAttributedString.alloc().initWithString_attributes_(attribution, attribution_attributes)
formatted_attribution.addAttribute_value_range_(NSFontAttributeName, NSFont.boldSystemFontOfSize_(NSFont.systemFontSize()), [0, len(font_name)])
super(AttributionText, self).__init__(dimensions, formatted_attribution)
示例2: font
# 需要導入模塊: from AppKit import NSFont [as 別名]
# 或者: from AppKit.NSFont import systemFontSize [as 別名]
def font(fontName, fontSize=None):
# Set the font by PostScript name.
# Optionally set the font size.
if fontSize is None:
fontSize = NSFont.systemFontSize()
NSFont.fontWithName_size_(fontName, fontSize)
示例3: drawPath
# 需要導入模塊: from AppKit import NSFont [as 別名]
# 或者: from AppKit.NSFont import systemFontSize [as 別名]
path = glyph._layer.bezierPath
drawPath(path)
def save():
# save the current graphic state
NSGraphicsContext.currentContext().saveGraphicsState()
def restore():
# restore the current graphic state
NSGraphicsContext.currentContext().restoreGraphicsState()
currentPath = None
currentFillColor = NSColor.blackColor()
currentStrokeColor = None
currentGradient = None
currentFont = NSFont.systemFontOfSize_(NSFont.systemFontSize())
def rect(x, y, width, height):
# draws a rectangle
drawPath(NSBezierPath.bezierPathWithRect_(NSMakeRect(x, y, width, height)))
def oval(x, y, width, height):
# draws an oval
drawPath(NSBezierPath.bezierPathWithOvalInRect_(NSMakeRect(x, y, width, height)))
def line(x1, y1, x2=None, y2=None):
# draws a line
if x2 is None and y2 is None and isinstance(x1, tuple) and isinstance(y1, tuple):
(x1, y1), (x2, y2) = x1, y1
p = NSBezierPath.bezierPath()
p.moveToPoint_(NSMakePoint(x1, y1))