本文整理汇总了Python中AppKit.NSColor.colorWithDeviceRed_green_blue_alpha_方法的典型用法代码示例。如果您正苦于以下问题:Python NSColor.colorWithDeviceRed_green_blue_alpha_方法的具体用法?Python NSColor.colorWithDeviceRed_green_blue_alpha_怎么用?Python NSColor.colorWithDeviceRed_green_blue_alpha_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppKit.NSColor
的用法示例。
在下文中一共展示了NSColor.colorWithDeviceRed_green_blue_alpha_方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: drawRect_
# 需要导入模块: from AppKit import NSColor [as 别名]
# 或者: from AppKit.NSColor import colorWithDeviceRed_green_blue_alpha_ [as 别名]
def drawRect_(self, rect):
if self.inLiveResize():
self._recalcSize()
from random import random
NSColor.redColor().set()
NSRectFill(self.bounds())
width, height = self.frame()[1]
w = width / 5
h = height / 5
for xI in range(5):
for yI in range(5):
x = xI * w
y = height - (yI * h) - h
r = ((x, y), (w, h))
NSColor.colorWithDeviceRed_green_blue_alpha_(random(), random(), random(), 1.0).set()
NSRectFill(r)
示例2: stroke
# 需要导入模块: from AppKit import NSColor [as 别名]
# 或者: from AppKit.NSColor import colorWithDeviceRed_green_blue_alpha_ [as 别名]
def stroke(r=None, g=None, b=None, a=1):
# Set the stroke color as RGB value.
global currentStrokeColor
if r is None:
currentStrokeColor = None
elif g is None:
currentStrokeColor = NSColor.colorWithDeviceWhite_alpha_(r, a)
else:
currentStrokeColor = NSColor.colorWithDeviceRed_green_blue_alpha_(r, g, b, a)
示例3: fill
# 需要导入模块: from AppKit import NSColor [as 别名]
# 或者: from AppKit.NSColor import colorWithDeviceRed_green_blue_alpha_ [as 别名]
def fill(r=None, g=None, b=None, a=1):
# Set the fill color as RGB value.
global currentFillColor
global currentGradient
if r is None:
currentFillColor = None
elif g is None:
currentFillColor = NSColor.colorWithDeviceWhite_alpha_(r, a)
currentGradient = None
else:
currentFillColor = NSColor.colorWithDeviceRed_green_blue_alpha_(r, g, b, a)
currentGradient = None
示例4: setBackgroundColor
# 需要导入模块: from AppKit import NSColor [as 别名]
# 或者: from AppKit.NSColor import colorWithDeviceRed_green_blue_alpha_ [as 别名]
def setBackgroundColor(self, color):
r, g, b, a = color
self.backgroundColor = color
self.w.backgroundColorWell.set(NSColor.colorWithDeviceRed_green_blue_alpha_(r, g, b, a))
示例5: setShapeColor
# 需要导入模块: from AppKit import NSColor [as 别名]
# 或者: from AppKit.NSColor import colorWithDeviceRed_green_blue_alpha_ [as 别名]
def setShapeColor(self, color):
r, g, b, a = color
self.shapeColor = color
self.w.shapeColorWell.set(NSColor.colorWithDeviceRed_green_blue_alpha_(r, g, b, a))