float --> int fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23903 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-09-24 20:24:51 +00:00
parent 04443bbfb0
commit 4c5304540d
4 changed files with 4 additions and 4 deletions

View File

@@ -57,7 +57,7 @@ class PyColourBox(wxPanel):
def SetColourTuple(self, colour): def SetColourTuple(self, colour):
"""Sets the box's current couple to the given tuple.""" """Sets the box's current couple to the given tuple."""
self.colour = colour self.colour = colour
self.colour_box.SetBackgroundColour(apply(wxColour, self.colour)) self.colour_box.SetBackgroundColour(wxColour(*self.colour))
def Update(self): def Update(self):
wxPanel.Update(self) wxPanel.Update(self)

View File

@@ -76,7 +76,7 @@ class PyColourSlider(canvas.Canvas):
vstep = 1.0 / self.HEIGHT vstep = 1.0 / self.HEIGHT
for y_pos in range(0, self.HEIGHT): for y_pos in range(0, self.HEIGHT):
r,g,b = [c * 255.0 for c in colorsys.hsv_to_rgb(h,s,v)] r,g,b = [c * 255.0 for c in colorsys.hsv_to_rgb(h,s,v)]
colour = wxColour(int(r), int(g),(b)) colour = wxColour(int(r), int(g), int(b))
self.buffer.SetPen(wxPen(colour, 1, wxSOLID)) self.buffer.SetPen(wxPen(colour, 1, wxSOLID))
self.buffer.DrawRectangle(0, y_pos, 15, 1) self.buffer.DrawRectangle(0, y_pos, 15, 1)
v = v - vstep v = v - vstep

View File

@@ -201,7 +201,7 @@ class PyPalette(canvas.Canvas):
for x in range(0, width, self.HORIZONTAL_STEP): for x in range(0, width, self.HORIZONTAL_STEP):
hue = float(x) / float(width) hue = float(x) / float(width)
r,g,b = colorsys.hsv_to_rgb(hue, saturation, value) r,g,b = colorsys.hsv_to_rgb(hue, saturation, value)
colour = wxColour(r * 255.0, g * 255.0, b * 255.0) colour = wxColour(int(r * 255.0), int(g * 255.0), int(b * 255.0))
self.buffer.SetPen(wxPen(colour, 1, wxSOLID)) self.buffer.SetPen(wxPen(colour, 1, wxSOLID))
self.buffer.SetBrush(wxBrush(colour, wxSOLID)) self.buffer.SetBrush(wxBrush(colour, wxSOLID))
self.buffer.DrawRectangle(x, y, self.buffer.DrawRectangle(x, y,

View File

@@ -40,6 +40,6 @@ def makeGray((r,g,b), factor, maskColor):
changed. changed.
""" """
if (r,g,b) != maskColor: if (r,g,b) != maskColor:
return map(lambda x: ((230 - x) * factor) + x, (r,g,b)) return map(lambda x: int((230 - x) * factor) + x, (r,g,b))
else: else:
return (r,g,b) return (r,g,b)