Does screenDC work on Mac?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Does screenDC work on Mac?

Quang Nguyen
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.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Does screenDC work on Mac?

Florian Höch
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

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Does screenDC work on Mac?

werner-3
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.
As per Phoenix doc you should always use PaintDC in an EVT_PAINT event.
http://wxpython.org/Phoenix/docs/html/PaintDC.html#paintdc

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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Does screenDC work on Mac?

Igor Korot
On Thu, Dec 4, 2014 at 9:55 AM, Werner <[hidden email]> wrote:

> 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.
>
> 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. ;-)

Thank you.

>
> 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 [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Does screenDC work on Mac?

Nathan McCorkle
In reply to this post by Quang Nguyen


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.


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
 

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.