New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pycolourchooser palette click broken #957

Closed
jbhopkins opened this Issue Aug 8, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@jbhopkins
Copy link

jbhopkins commented Aug 8, 2018

Operating system: MacOS 10.13.6
wxPython version: 4.0.3 osx-cocoa (phoenix) wxWidgets 3.0.5
Stock or custom build: Stock, installed from conda
Python version: 2.7.15
Stock or custom build: Stock, miniconda distribution

I have an application that uses the PyColourChooser, including the palette. I've been working on updating it for wxpython4. I've found that when you click on the palette you get these error messages:

Traceback (most recent call last):
  File "/Users/jessehopkins/miniconda2/lib/python2.7/site-packages/wx/lib/colourchooser/pycolourchooser.py", line 464, in onPaletteDown
    self.doPaletteClick(event.GetX(), event.GetY())
  File "/Users/jessehopkins/miniconda2/lib/python2.7/site-packages/wx/lib/colourchooser/pycolourchooser.py", line 493, in doPaletteClick
    colour = self.getColourFromControls()
  File "/Users/jessehopkins/miniconda2/lib/python2.7/site-packages/wx/lib/colourchooser/pycolourchooser.py", line 384, in getColourFromControls
    return self.hsvToColour((h, s, v))
  File "/Users/jessehopkins/miniconda2/lib/python2.7/site-packages/wx/lib/colourchooser/pycolourchooser.py", line 370, in hsvToColour
    return wx.Colour(r, g, b)
TypeError: Colour(): arguments did not match any overloaded call:
  overload 1: too many arguments
  overload 2: argument 1 has unexpected type 'float'
  overload 3: argument 1 has unexpected type 'float'
  overload 4: argument 1 has unexpected type 'float'

Traceback (most recent call last):
  File "/Users/jessehopkins/miniconda2/lib/python2.7/site-packages/wx/lib/colourchooser/pycolourchooser.py", line 472, in onPaletteUp
    self.palette.ReleaseMouse() # Must call once for each CaputreMouse()
wxAssertionError: C++ assertion "!wxMouseCapture::stack.empty()" failed at /opt/concourse/worker/volumes/live/1bdcb0c4-b57f-443e-4aec-3572580f642b/volume/wxpython_1529592300425/work/ext/wxWidgets/src/common/wincmn.cpp(3319) in ReleaseMouse(): Releasing mouse capture but capture stack empty?

Upon investigation, it looks like in pycolourchooser.py, line 370 (in hsvToColour) is passing floats to wx.Colour instead of ints. This problem is easily duplicated just using the PyColourChooser in the wxpython demo.

I was able to fix it by simply changing line 370 to:

return wx.Colour(int(r), int(g), int(b))

This fixed both errors above. I'm hoping this can be easily incorporated into the next point release.

mesalu added a commit to mesalu/Phoenix that referenced this issue Aug 13, 2018

@mesalu mesalu referenced this issue Aug 13, 2018

Merged

Fix #957 #960

RobinD42 added a commit that referenced this issue Aug 14, 2018

Fix #957 (#960)
Round RGB values to integers for creating the `wx.Colour`

RobinD42 added a commit to RobinD42/Phoenix that referenced this issue Aug 14, 2018

Fix wxWidgets#957 (wxWidgets#960)
Round RGB values to integers for creating the `wx.Colour`
(cherry picked from commit 5c68798)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment