def initWithFrame_(self, frame): circleRadius = 100 colors = [ ( 0.5, 0.0, 0.5, 1 ), ( 1.0, 0.7, 0.0, 1 ), ( 0.0, 0.5, 0.0, 1 ), ] self = super(TLayerView, self).initWithFrame_(frame) if self is None: return None self.useTLayer = False; self.circles = [] for c in colors: color = NSColor.colorWithCalibratedRed_green_blue_alpha_(*c) circle = Circle.alloc().init() circle.color = color circle.radius = circleRadius circle.center = makeRandomPointInRect(self.bounds()) self.circles.append(circle) self.registerForDraggedTypes_([NSColorPboardType]) self.setNeedsDisplay_(True) return self
def initWithFrame_(self, frame): circleRadius = 100 colors = [ (0.5, 0.0, 0.5, 1), (1.0, 0.7, 0.0, 1), (0.0, 0.5, 0.0, 1), ] self = super(TLayerView, self).initWithFrame_(frame) if self is None: return None self.useTLayer = False self.circles = [] for c in colors: color = Cocoa.NSColor.colorWithCalibratedRed_green_blue_alpha_(*c) circle = Circle.alloc().init() circle.color = color circle.radius = circleRadius circle.center = makeRandomPointInRect(self.bounds()) self.circles.append(circle) self.registerForDraggedTypes_([Cocoa.NSColorPboardType]) self.setNeedsDisplay_(True) return self