Hi
I am trying to create a Cairo context from a wx.MemoryDC in Phoenix
(Python3 on Debian sid) using GTK3. (I am using the Phoenix code from
https://github.com/wxWidgets/Phoenix)
Unfortunately, I get the following error, when running the attached
code:
$ python3 test_cairo.py
Gtk-Message: (for origin information, set GTK_DEBUG): failed to
retrieve property `gtk-primary-button-warps-slider' of type `gboolean'
from rc file value "((GString*) 0x55b6d256b180)" of type `gboolean'
Traceback (most recent call last): File "test_cairo.py", line 14, in
<module> top = Frame() File "test_cairo.py", line 11, in __init__
context = wx.lib.wxcairo.ContextFromDC(mdc)
File "/home/mn/prog/Phoenix/wx/lib/wxcairo/__init__.py", line 80, in
ContextFromDC return _ContextFromDC(dc)
File "/home/mn/prog/Phoenix/wx/lib/wxcairo/wx_cairocffi.py", line
104, in _ContextFromDC ctx = cairocffi.Context._from_pointer(ctxptr,
False) File "/usr/lib/python3/dist-packages/cairocffi/context.py", line
126, in _from_pointer cls._init_pointer(self, pointer)
File "/usr/lib/python3/dist-packages/cairocffi/context.py", line 104,
in _init_pointer self._pointer = ffi.gc(pointer, cairo.cairo_destroy)
TypeError: gc() argument 1 must be _cffi_backend.CData, not int
/home/mn/prog/Phoenix/ext/wxWidgets/src/gtk/dcclient.cpp(250): assert
"Assert failure" failed in wxFreePoolGC(): Wrong
GC /home/mn/prog/Phoenix/ext/wxWidgets/src/gtk/dcclient.cpp(250):
assert "Assert failure" failed in wxFreePoolGC(): Wrong
GC /home/mn/prog/Phoenix/ext/wxWidgets/src/gtk/dcclient.cpp(250):
assert "Assert failure" failed in wxFreePoolGC(): Wrong
GC /home/mn/prog/Phoenix/ext/wxWidgets/src/gtk/dcclient.cpp(250):
assert "Assert failure" failed in wxFreePoolGC(): Wrong GC
I would appreciate any ideas on how to derive a Cairo context from a
wx.MemoryDC or from a Bitmap.
Martin
test_cairo.py (334 Bytes)