I’ve written an application using drawing implementation from http://wiki.wxpython.org/DoubleBufferedDrawing. A Mac user reported errors. So, asked her (I have no Mac) to test the simple application from the wiki and here is the result:
Wed Nov 28 12:04:32 user-iMac.local pythonw2.6[29128] : CGBitmapContextCreate: invalid data bytes/row: should be at least 4 for 8 integer bits/component, 3 components, kCGImageAlphaNoneSkipFirst.
Wed Nov 28 12:04:32 user-iMac.local pythonw2.6[29128] : CGContextTranslateCTM: invalid context 0x0
Wed Nov 28 12:04:32 user-iMac.local pythonw2.6[29128] : CGContextScaleCTM: invalid context 0x0
Traceback (most recent call last):
File “./BufferedWindow.py”, line 215, in
app = DemoApp(0)
File “/var/tmp/wxWidgets/wxWidgets-13~231/2.6/DSTROOT/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode/wx/_core.py”, line 7913, in init
File “/var/tmp/wxWidgets/wxWidgets-13~231/2.6/DSTROOT/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode/wx/_core.py”, line 7487, in _BootstrapApp
File “./BufferedWindow.py”, line 209, in OnInit
frame = TestFrame()
File “./BufferedWindow.py”, line 147, in init
self.Window = DrawWindow(self)
File “./BufferedWindow.py”, line 98, in init
BufferedWindow.init(self, *args, **kwargs)
File “./BufferedWindow.py”, line 41, in init
self.OnSize(None)
File “./BufferedWindow.py”, line 66, in OnSize
self._Buffer = wx.EmptyBitmap(*Size)
File “/var/tmp/wxWidgets/wxWidgets-13~231/2.6/DSTROOT/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode/wx/_gdi.py”, line 726, in EmptyBitmap
wx._core.PyAssertionError: C++ assertion “m_hBitmap” failed at …/src/mac/carbon/bitmap.cpp(242) in Create(): Unable to create CGBitmapContext context
Does anyone an idea what’s going on? I haven’t tested on windows yet. On Linux it works.
It works fine on my Mac. Which OSX is it? Which Python (version and Apple's, Python.org's, macport's, etc.)? Which wxPython?
···
On 11/28/12 9:51 AM, annakrat wrote:
Hi all,
I've written an application using drawing implementation from DoubleBufferedDrawing - wxPyWiki. A Mac user reported
errors. So, asked her (I have no Mac) to test the simple application
from the wiki and here is the result:
Wed Nov 28 12:04:32 user-iMac.local pythonw2.6[29128] <Error>:
CGBitmapContextCreate: invalid data bytes/row: should be at least 4 for
8 integer bits/component, 3 components, kCGImageAlphaNoneSkipFirst.
Wed Nov 28 12:04:32 user-iMac.local pythonw2.6[29128] <Error>:
CGContextTranslateCTM: invalid context 0x0
Wed Nov 28 12:04:32 user-iMac.local pythonw2.6[29128] <Error>:
CGContextScaleCTM: invalid context 0x0
Traceback (most recent call last):
File "./BufferedWindow.py", line 215, in <module>
app = DemoApp(0)
File
"/var/tmp/wxWidgets/wxWidgets-13~231/2.6/DSTROOT/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode/wx/_core.py",
line 7913, in __init__
File
"/var/tmp/wxWidgets/wxWidgets-13~231/2.6/DSTROOT/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode/wx/_core.py",
line 7487, in _BootstrapApp
File "./BufferedWindow.py", line 209, in OnInit
frame = TestFrame()
File "./BufferedWindow.py", line 147, in __init__
self.Window = DrawWindow(self)
File "./BufferedWindow.py", line 98, in __init__
BufferedWindow.__init__(self, *args, **kwargs)
File "./BufferedWindow.py", line 41, in __init__
self.OnSize(None)
File "./BufferedWindow.py", line 66, in OnSize
self._Buffer = wx.EmptyBitmap(*Size)
File
"/var/tmp/wxWidgets/wxWidgets-13~231/2.6/DSTROOT/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode/wx/_gdi.py",
line 726, in EmptyBitmap
wx._core.PyAssertionError: C++ assertion "m_hBitmap" failed at
../src/mac/carbon/bitmap.cpp(242) in Create(): Unable to create
CGBitmapContext context
Does anyone an idea what's going on? I haven't tested on windows yet. On
Linux it works.
That page is pretty old--newer systems do a lot of buffering
themselves, so it's worth testing to make sure you really need it.
And maybe have it optional depending on platform.
- Chris
···
On Nov 28, 2012, at 10:48 AM, Robin Dunn <robin@alldunn.com> wrote:
On 11/28/12 9:51 AM, annakrat wrote:
Hi all,
I've written an application using drawing implementation from DoubleBufferedDrawing - wxPyWiki. A Mac user reported
errors. So, asked her (I have no Mac) to test the simple application
from the wiki and here is the result:
Wed Nov 28 12:04:32 user-iMac.local pythonw2.6[29128] <Error>:
CGBitmapContextCreate: invalid data bytes/row: should be at least 4 for
8 integer bits/component, 3 components, kCGImageAlphaNoneSkipFirst.
Wed Nov 28 12:04:32 user-iMac.local pythonw2.6[29128] <Error>:
CGContextTranslateCTM: invalid context 0x0
Wed Nov 28 12:04:32 user-iMac.local pythonw2.6[29128] <Error>:
CGContextScaleCTM: invalid context 0x0
Traceback (most recent call last):
File "./BufferedWindow.py", line 215, in <module>
app = DemoApp(0)
File
"/var/tmp/wxWidgets/wxWidgets-13~231/2.6/DSTROOT/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode/wx/_core.py",
line 7913, in __init__
File
"/var/tmp/wxWidgets/wxWidgets-13~231/2.6/DSTROOT/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode/wx/_core.py",
line 7487, in _BootstrapApp
File "./BufferedWindow.py", line 209, in OnInit
frame = TestFrame()
File "./BufferedWindow.py", line 147, in __init__
self.Window = DrawWindow(self)
File "./BufferedWindow.py", line 98, in __init__
BufferedWindow.__init__(self, *args, **kwargs)
File "./BufferedWindow.py", line 41, in __init__
self.OnSize(None)
File "./BufferedWindow.py", line 66, in OnSize
self._Buffer = wx.EmptyBitmap(*Size)
File
"/var/tmp/wxWidgets/wxWidgets-13~231/2.6/DSTROOT/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode/wx/_gdi.py",
line 726, in EmptyBitmap
wx._core.PyAssertionError: C++ assertion "m_hBitmap" failed at
../src/mac/carbon/bitmap.cpp(242) in Create(): Unable to create
CGBitmapContext context
Does anyone an idea what's going on? I haven't tested on windows yet. On
Linux it works.
It works fine on my Mac. Which OSX is it? Which Python (version and Apple's, Python.org's, macport's, etc.)? Which wxPython?
Dne pátek, 30. listopadu 2012 1:50:54 UTC+1 Chris Barker - NOAA Federal napsal(a):
One other note:
That page is pretty old–newer systems do a lot of buffering
themselves, so it’s worth testing to make sure you really need it.
And maybe have it optional depending on platform.
If I don’t need buffering, how should I do that? Is there any code available on the wiki? Sorry, I have never fully understood the concept of drawing in wx.
Dne pátek, 30. listopadu 2012 1:50:54 UTC+1 Chris Barker - NOAA Federal napsal(a):
One other note:
That page is pretty old–newer systems do a lot of buffering
themselves, so it’s worth testing to make sure you really need it.
And maybe have it optional depending on platform.
If I don’t need buffering, how should I do that? Is there any code available on the wiki? Sorry, I have never fully understood the concept of drawing in wx.
Nowadays there is wx.AutoBufferedPaintDC, which will create a buffered or non-buffered paint dc as the platform needs. Then you can just do all your drawing in the OnPaint handler as you would with an un-buffered control.
Dne pátek, 30. listopadu 2012 1:50:54 UTC+1 Chris Barker - NOAA Federal napsal(a):
One other note:
That page is pretty old–newer systems do a lot of buffering
themselves, so it’s worth testing to make sure you really need it.
And maybe have it optional depending on platform.
If I don’t need buffering, how should I do that? Is there any code available on the wiki? Sorry, I have never fully understood the concept of drawing in wx.
Nowadays there is wx.AutoBufferedPaintDC, which will create a buffered or non-buffered paint dc as the platform needs. Then you can just do all your drawing in the OnPaint handler as you would with an un-buffered control.
Thanks, I was not aware of this DC. This looks pretty easy.