本文整理汇总了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))