Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b7eb868

Browse files
authored
Merge pull request #18712 from anntzer/wxc
Shorten GraphicsContextWx.get_wxcolour.
2 parents 5cc6a15 + e996655 commit b7eb868

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

lib/matplotlib/backends/backend_wx.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -418,23 +418,7 @@ def set_joinstyle(self, js):
418418
def get_wxcolour(self, color):
419419
"""Convert a RGB(A) color to a wx.Colour."""
420420
_log.debug("%s - get_wx_color()", type(self))
421-
if len(color) == 3:
422-
r, g, b = color
423-
r *= 255
424-
g *= 255
425-
b *= 255
426-
return wx.Colour(red=int(r), green=int(g), blue=int(b))
427-
else:
428-
r, g, b, a = color
429-
r *= 255
430-
g *= 255
431-
b *= 255
432-
a *= 255
433-
return wx.Colour(
434-
red=int(r),
435-
green=int(g),
436-
blue=int(b),
437-
alpha=int(a))
421+
return wx.Colour(*[int(255 * x) for x in color])
438422

439423

440424
class _FigureCanvasWxBase(FigureCanvasBase, wx.Panel):

0 commit comments

Comments
 (0)