|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]|
I am starting now in programming python, I choose PyObj-C so I could use my Obj-C and Cocoa previous knowledge.
The point is that I am trying to subclass a NSOpenGL view without success!
When I try to subclass an NSView all is fine, both "initWithFrame_(self, frame):" and "drawRect_(self, rect):"
On the other hand, when instantiating the NSOpenGLView subclass the "initWithFrame_pixelformat_(self, frame, fmt):" method is not called avoiding me any kind of initialization. The crazy ( even for me ) thing is that
the "def drawRect_(self, rect):" is called fine...
Here is the code of my NSOpenGLView subclass:
from objc import YES, NO, IBAction, IBOutlet
from Foundation import *
from AppKit import *
from OpenGL.GL import *
def initWithFrame_pixelformat_(self, frame, fmt):
self = super(PiiOpenGLView, self).initWithFrame_pixelformat_(frame, fmt)
# initialization code here
self.col = NSColor.blueColor()
self.b = self.bounds()
def drawRect_(self, rect):
# drawing code here
#self.col = NSColor.redColor()
#self.b = self.bounds()
Here is the code of my "main.py" main class:
#import modules required by application
from PyObjCTools import AppHelper
# import modules containing classes required to start application and load MainMenu.nib
# pass control to AppKit
subclass Thanks All :)
_______________________________________________ Do not post admin requests to the list. They will be ignored. Student-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
Visit the Apple Store online or at retail locations.
Copyright © 2011 Apple Inc. All rights reserved.