Open
Description
I am trying to create a PangoCairo context from a Cairo context.
I am using Python 3.5.3 on Debian sid, wxPython checkout a92cef7
with Subproject commit dc7acca2cd4c87fb2541df17d8b4d80e0f607cc8
The package python3-gi-cairo is installed.
import wx
import wx.lib.wxcairo
import gi
gi.require_version('PangoCairo', '1.0')
from gi.repository import PangoCairo
class Frame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None)
mdc = wx.MemoryDC()
bmp = wx.Bitmap(10, 10)
mdc.SelectObject(bmp)
context = wx.lib.wxcairo.ContextFromDC(mdc)
pangocairo_context = PangoCairo.create_context(context)
app = wx.App(redirect=False)
top = Frame()
top.Show()
app.MainLoop()
However, I get the following error message:
$ 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*) 0x563022e935a0)" of type `gboolean'
Traceback (most recent call last):
File "test_cairo.py", line 20, in <module>
top = Frame()
File "test_cairo.py", line 16, in __init__
pangocairo_context = PangoCairo.create_context(context)
KeyError: 'could not find foreign type Context'
/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 expected that line 16 would provide a PangoCairo context.