How to tell if I'm printing?

I've got some code that takes a DC and draws some stuff.

However, I'd like to do something slightly different if I'm printing that if I'm drawing to the screen.

Is there a way to tell if a given DC is a PrinterDC, so I can put some conditional code in there?

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Hello,

···

On Thu, Jan 8, 2009 at 4:07 PM, Christopher Barker Chris.Barker@noaa.gov wrote:

I’ve got some code that takes a DC and draws some stuff.

However, I’d like to do something slightly different if I’m printing that if I’m drawing to the screen.

Is there a way to tell if a given DC is a PrinterDC, so I can put some conditional code in there?

Have you tried,

isinstance(someDC, wx.PrinterDC)

Cody

Cody Precord wrote:

···

On Thu, Jan 8, 2009 at 4:07 PM, Christopher Barker wrote:
    Is there a way to tell if a given DC is a PrinterDC, so I can put
    some conditional code in there?

Have you tried,

isinstance(someDC, wx.PrinterDC)

OK, you caught me, I'm cheating -- I need this to work in C++, but I'm not on the wx-users list now, and you folks are so helpful!

I was just mentioning that such introspection was trivial in Python...

thanks,

-Chris

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Christopher Barker wrote:

Cody Precord wrote:

    Is there a way to tell if a given DC is a PrinterDC, so I can put
    some conditional code in there?

Have you tried,

isinstance(someDC, wx.PrinterDC)

OK, you caught me, I'm cheating -- I need this to work in C++, but I'm not on the wx-users list now, and you folks are so helpful!

You should be able to use wxDynamicCast and check if the result is non-NULL.

···

On Thu, Jan 8, 2009 at 4:07 PM, Christopher Barker wrote:

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!