Does screenDC work on Mac?

Hi everyone,

I have been trying to use screenDC to paint anywhere on the desktop screen (I suppose it does that?). But when using it it does not paint anything at all. I am using this simple code in an OnPaint function that has been binded using wx.EVT_PAINT.

	s = wx.ScreenDC()

	s.StartDrawingOnTop(None)

	s.SetPen(wx.Pen('red', 2))

	s.DrawRectangle(60,60,120,120)

If I replace ScreenDC() with PaintDC(self.panel) it does draw but only in the panel that it is given to it. So I am not sure if ScreenDC is failing because I am on a Mac or not, can anyone confirm this?

My goal is to paint something without having to see a Frame/panel. I also tried setting the Frame/panel to Transparant but that will make all drawings transparant too.

Hi,

···

Am 04.12.2014 um 04:13 schrieb Quang Nguyen:

I have been trying to use screenDC to paint anywhere on the desktop
screen (I suppose it does that?). But when using it it does not paint
anything at all. I am using this simple code in an OnPaint function that
has been binded using wx.EVT_PAINT.

s = wx.ScreenDC()
s.StartDrawingOnTop(None)
s.SetPen(wx.Pen('red', 2))
s.DrawRectangle(60,60,120,120)

If I replace ScreenDC() with PaintDC(self.panel) it does draw but only
in the panel that it is given to it. So I am not sure if ScreenDC is
failing because I am on a Mac or not, can anyone confirm this?

I can definitely confirm this, ScreenDC doesn't work under Mac OS X.

--
Florian Höch

As per Phoenix doc you should always use PaintDC in an EVT_PAINT event.
http://wxpython.org/Phoenix/docs/html/PaintDC.html#paintdc

Werner

···

On 12/4/2014 4:56, Florian Höch wrote:

Hi,

Am 04.12.2014 um 04:13 schrieb Quang Nguyen:

I have been trying to use screenDC to paint anywhere on the desktop
screen (I suppose it does that?). But when using it it does not paint
anything at all. I am using this simple code in an OnPaint function that
has been binded using wx.EVT_PAINT.

s = wx.ScreenDC()
s.StartDrawingOnTop(None)
s.SetPen(wx.Pen('red', 2))
s.DrawRectangle(60,60,120,120)

If I replace ScreenDC() with PaintDC(self.panel) it does draw but only
in the panel that it is given to it. So I am not sure if ScreenDC is
failing because I am on a Mac or not, can anyone confirm this?

I can definitely confirm this, ScreenDC doesn't work under Mac OS X.

Hi,

I have been trying to use screenDC to paint anywhere on the desktop
screen (I suppose it does that?). But when using it it does not paint
anything at all. I am using this simple code in an OnPaint function that
has been binded using wx.EVT_PAINT.

s = wx.ScreenDC()
s.StartDrawingOnTop(None)
s.SetPen(wx.Pen('red', 2))
s.DrawRectangle(60,60,120,120)

If I replace ScreenDC() with PaintDC(self.panel) it does draw but only
in the panel that it is given to it. So I am not sure if ScreenDC is
failing because I am on a Mac or not, can anyone confirm this?

I can definitely confirm this, ScreenDC doesn't work under Mac OS X.

As per Phoenix doc you should always use PaintDC in an EVT_PAINT event.
http://wxpython.org/Phoenix/docs/html/PaintDC.html#paintdc

Simply because it will fail on Windows otherwise. :wink:

Thank you.

···

On Thu, Dec 4, 2014 at 9:55 AM, Werner <wernerfbd@gmx.ch> wrote:

On 12/4/2014 4:56, Florian Höch wrote:

Am 04.12.2014 um 04:13 schrieb Quang Nguyen:

Werner

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Here is some code that has both PaintDC and ScreenDC in the OnPaint method (you can comment and uncomment them interchangeably)… maybe it will help you along.

https://groups.google.com/d/msg/wxpython-users/RAcCNwWhGJk/utB0SBE41HMJ

···

On Wednesday, December 3, 2014 7:13:17 PM UTC-8, Quang Nguyen wrote:

Hi everyone,

I have been trying to use screenDC to paint anywhere on the desktop screen (I suppose it does that?). But when using it it does not paint anything at all. I am using this simple code in an OnPaint function that has been binded using wx.EVT_PAINT.

  s = wx.ScreenDC()
  s.StartDrawingOnTop(None)
  s.SetPen(wx.Pen('red', 2))
  s.DrawRectangle(60,60,120,120)

If I replace ScreenDC() with PaintDC(self.panel) it does draw but only in the panel that it is given to it. So I am not sure if ScreenDC is failing because I am on a Mac or not, can anyone confirm this?

My goal is to paint something without having to see a Frame/panel. I also tried setting the Frame/panel to Transparant but that will make all drawings transparant too.