FROM : Bill Bumgarner
DATE : Wed Nov 07 17:48:57 2007
On Nov 7, 2007, at 1:41 AM, Uliano Guerrini wrote:
> Il giorno 07/nov/07, alle ore 09:57, Bill Bumgarner ha scritto:
>> Whether or not this is a bug in the Quartz module is semi-
>> debatable. It is certainly inconvenient, but it is not unheard of
>> for Python modules to behave this way.
> ok, maybe I'm not enough confident with pyobjc, but I would like to
> know how to use Quartz in, say, the drawRect method of a subclass
> of NSView say myView
>
> If I don't import myView in the main.py the view isn't drawn, so let
> it be there
>
> If I import Quartz in myView.py I got the problem... if I don't how
> can the methods in myView.py know about Quarz?
Import Quartz *after* the application's main event loop has been
started, either in applicationDidFinishLaunching_() as I demonstrated
in my first message:
> class FoobarAppDelegate(NSObject):
> def applicationDidFinishLaunching_(self, sender):
> import Quartz
Or import it as the first line of the drawRect_() method of your view.
Unless you are explicitly subclassing something from the Quartz
module, there is no need to import Quartz until you actually need it.
Importing it in drawRect_() is inefficient, but not grossly so as
Python short circuits the import of an already imported module.
b.bum
DATE : Wed Nov 07 17:48:57 2007
On Nov 7, 2007, at 1:41 AM, Uliano Guerrini wrote:
> Il giorno 07/nov/07, alle ore 09:57, Bill Bumgarner ha scritto:
>> Whether or not this is a bug in the Quartz module is semi-
>> debatable. It is certainly inconvenient, but it is not unheard of
>> for Python modules to behave this way.
> ok, maybe I'm not enough confident with pyobjc, but I would like to
> know how to use Quartz in, say, the drawRect method of a subclass
> of NSView say myView
>
> If I don't import myView in the main.py the view isn't drawn, so let
> it be there
>
> If I import Quartz in myView.py I got the problem... if I don't how
> can the methods in myView.py know about Quarz?
Import Quartz *after* the application's main event loop has been
started, either in applicationDidFinishLaunching_() as I demonstrated
in my first message:
> class FoobarAppDelegate(NSObject):
> def applicationDidFinishLaunching_(self, sender):
> import Quartz
Or import it as the first line of the drawRect_() method of your view.
Unless you are explicitly subclassing something from the Quartz
module, there is no need to import Quartz until you actually need it.
Importing it in drawRect_() is inefficient, but not grossly so as
Python short circuits the import of an already imported module.
b.bum
| Related mails | Author | Date |
|---|---|---|
| Uliano Guerrini | Nov 7, 08:49 | |
| Bill Bumgarner | Nov 7, 08:58 | |
| Uliano Guerrini | Nov 7, 09:46 | |
| Bill Bumgarner | Nov 7, 09:57 | |
| Uliano Guerrini | Nov 7, 10:41 | |
| Bill Bumgarner | Nov 7, 17:48 | |
| Uliano Guerrini | Nov 7, 18:04 | |
| Bill Bumgarner | Nov 7, 18:46 | |
| Luc Heinrich | Nov 8, 09:32 | |
| Uliano Guerrini | Nov 8, 13:00 | |
| Luc Heinrich | Nov 8, 14:10 | |
| Uliano Guerrini | Nov 8, 14:41 |






Cocoa mail archive

