Round RGB values to integers for creating the `wx.Colour`
This commit is contained in:
Mesalu
2018-08-13 22:03:29 -07:00
committed by Robin Dunn
parent 10baff1d24
commit 5c68798d0c
2 changed files with 11 additions and 5 deletions

View File

@@ -62,7 +62,7 @@ Changes in this release include the following:
* Switch wx.lib.plot to issue deprecation warnings with PlotPendingDeprecation
so it doesn't have to enable all warnings to get them to be shown by default.
(#902)
* Added a Python 3.7 builder on Fedora 28. (#925)
* Fix the object ownership transfer for wx.Menu.Insert() (#931)
@@ -89,7 +89,7 @@ Changes in this release include the following:
* Fix missing parameter tool_id in
wx.lib.agw.ribbon.toolbar.RibbonToolBar.AddToggleTool. (#947)
* Add a step to wx.Config.ReadInt to attempt converting from long to int
* Add a step to wx.Config.ReadInt to attempt converting from long to int
under python2. (#384)
* Add virtual behavior for wx.RichTextCtrl and wx.TextCtrl's Copy/Cut/Paste methods
@@ -97,6 +97,10 @@ Changes in this release include the following:
* Fix IO type in wx.lib.agw.thumbnailctrl (#959)
* Fix type error that would occur using pycolourchooser. (#957)
4.0.3 "The show must go on. (Die show-stoppers! Die!)"
------------------------------------------------------
* 25-June-2018

View File

@@ -363,9 +363,11 @@ class PyColourChooser(wx.Panel):
# Allow values to go full range from 0 to 255
r, g, b = colorsys.hsv_to_rgb(hsv[0], hsv[1], hsv[2])
r *= 255.0
g *= 255.0
b *= 255.0
round_tenths = lambda x: int(x + 0.5)
r = round_tenths(r * 255.0)
g = round_tenths(g * 255.0)
b = round_tenths(b * 255.0)
return wx.Colour(r, g, b)