From b8aab4d28d578817139f9038deec03e9609a50c8 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 19 May 2006 01:57:30 +0000 Subject: [PATCH] memory dc must have bitmap selected into it before it can be used for measuring git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39221 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/wx/lib/fancytext.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wxPython/wx/lib/fancytext.py b/wxPython/wx/lib/fancytext.py index 16e4a5e8b3..df7772e94b 100644 --- a/wxPython/wx/lib/fancytext.py +++ b/wxPython/wx/lib/fancytext.py @@ -350,6 +350,9 @@ def GetFullExtent(str, dc=None, enclose=True): def RenderToBitmap(str, background=None, enclose=1): "Return str rendered on a minumum size bitmap" dc = wx.MemoryDC() + # Chicken and egg problem, we need a bitmap in the DC in order to + # measure how big the bitmap should be... + dc.SelectObject(wx.EmptyBitmap(1,1)) width, height, dy = GetFullExtent(str, dc, enclose) bmp = wx.EmptyBitmap(width, height) dc.SelectObject(bmp) -- 2.45.2