-
Notifications
You must be signed in to change notification settings - Fork 150
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
Color handling error in Python mode. #68
Comments
In Hype, HRect is an extension of HDrawable. Within HDrawable, the fill method accepts an int as it's color, or multiples of int i.e. (grey), (grey, alpha), (r, g, b), (r, g, b, alpha). While you can pass a hex in there, I'm assuming Processing itself understands to convert that hex to an int at compilation. Passing the hex as a string currently doesn't work in Hype. The drawable class would need to be updated to have more fill methods that support a hex passed as a string. Incidentally, If you wanted to make Hype work with Processing.py, I would think a separate port of Hype would be best as not to bloat the core with .py specific methods. |
Ben is correct... for example : color c = color(#FF3300); String c = "#FF3300"; void setup() { Joshua Davis Joshua Davis Studios, Inc. portfolio : http://www.joshuadavis.com twitter : http://twitter.com/joshuadavis On Mon, Jun 23, 2014 at 12:43 PM, tracerstar [email protected]
|
Right, exactly; the Python mode does the string->int conversion. It should be passing an int to HYPE; that's where I'm a little confused as to why this doesn't work. RE: porting HYPE - The Python mode is really Java; the back end is jython. Looks like python, tastes like Python, but when you start to really scratch it hard, it's Python syntax for Processing. This is not a bad thing (e.g. most Java Processing libraries don't need any conversion at all - they Just Work). The .py-specific bloat is entirely contained within the Python mode - that's what it's there for. |
::chuckles:: |
The workaround for hex-notation for colors is to use e.g. |
Hi. I'm the author of Python Mode. I don't want any library author to have to worry about the design of Python Mode, except when the library design makes it actually impossible to use (as when it depends on introspection of a method name). So I consider this bug to be entirely my problem. If you're interested in it, feel free to come and comment on https://github.com/jdf/processing.py/issues/97. |
Mr. Feinberg was nice enough to allow designating hex colors like so when using the Processing Python mode[1]:
Unfortunately, HYPE methods don't seem to like this:
yields
I recognize that this might actually be uncovering a subtle bug or missing function in the Python mode, but I figured I'd try here first, as the error only occurs when using HYPE.
[1] '#' is the Python comment designator.
The text was updated successfully, but these errors were encountered: