• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa Python broken in Leopard??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Python broken in Leopard??


  • Subject: Re: Cocoa Python broken in Leopard??
  • From: Bill Bumgarner <email@hidden>
  • Date: Wed, 7 Nov 2007 08:48:57 -0800

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

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Cocoa Python broken in Leopard??
      • From: Luc Heinrich <email@hidden>
    • Re: Cocoa Python broken in Leopard??
      • From: Uliano Guerrini <email@hidden>
References: 
 >Cocoa Python broken in Leopard?? (From: Uliano Guerrini <email@hidden>)
 >Re: Cocoa Python broken in Leopard?? (From: Bill Bumgarner <email@hidden>)
 >Re: Cocoa Python broken in Leopard?? (From: Uliano Guerrini <email@hidden>)
 >Re: Cocoa Python broken in Leopard?? (From: Bill Bumgarner <email@hidden>)
 >Re: Cocoa Python broken in Leopard?? (From: Uliano Guerrini <email@hidden>)

  • Prev by Date: -[NSApplication requestUserAttention:] return value?
  • Next by Date: Re: -[NSApplication requestUserAttention:] return value?
  • Previous by thread: Re: Cocoa Python broken in Leopard??
  • Next by thread: Re: Cocoa Python broken in Leopard??
  • Index(es):
    • Date
    • Thread