From 62ffa6f4a3d49b29424124734c5fcc911748d8a0 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 28 Jan 2021 18:24:41 -0500 Subject: [PATCH 1/2] wx: Use an integral font size. This is a very-small partial revert of #15292, which claimed that wx supports floats, but this no longer appears to be the case with Python 3.10, and looking at the C++ class constructor [1], should not have ever been supported. [1] https://docs.wxwidgets.org/3.0/classwx_font.html --- lib/matplotlib/backends/backend_wx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index 2113e3723ac2..b6d656d373ba 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -297,10 +297,11 @@ def get_wx_font(self, s, prop): font = self.fontd.get(key) if font is not None: return font + size = self.points_to_pixels(prop.get_size_in_points()) # Font colour is determined by the active wx.Pen # TODO: It may be wise to cache font information self.fontd[key] = font = wx.Font( # Cache the font and gc. - pointSize=self.points_to_pixels(prop.get_size_in_points()), + pointSize=int(size + 0.5), family=self.fontnames.get(prop.get_name(), wx.ROMAN), style=self.fontangles[prop.get_style()], weight=self.fontweights[prop.get_weight()]) From be40c5ca53e99e02e7cdb55ad0d985249628f284 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 28 Jan 2021 18:51:27 -0500 Subject: [PATCH 2/2] wx: Only pass integers to event loop timer. --- lib/matplotlib/backends/backend_wx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index b6d656d373ba..a5f335cbbc32 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -568,7 +568,7 @@ def start_event_loop(self, timeout=0): raise RuntimeError("Event loop already running") timer = wx.Timer(self, id=wx.ID_ANY) if timeout > 0: - timer.Start(timeout * 1000, oneShot=True) + timer.Start(int(timeout * 1000), oneShot=True) self.Bind(wx.EVT_TIMER, self.stop_event_loop, id=timer.GetId()) # Event loop handler for start/stop event loop self._event_loop = wx.GUIEventLoop() pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy