You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having trouble with Mixbox on Programiz, a Python I used the following code.
`import mixbox
rgb1 = (0, 33, 133) # blue
rgb2 = (252, 211, 0) # yellow
t = 0.5 # mixing ratio
rgb_mix = mixbox.lerp(rgb1,rgb2,t)
print(rgb_mix)`
But this is what I recieved.
`ERROR!
Traceback (most recent call last):
File "<main.py>", line 3, in
ModuleNotFoundError: No module named 'mixbox'
=== Code Exited With Errors ===`
Alternatively, I was tying to make Mixbox mix multiple colors work in a JavaScript Compiler. Programiz does that too, but I also used Tynker, since it has an HTML extension. I was able to make the simple usage work on a HTML. This is my code.
`var rgb1 = "rgb(0, 33, 133)"; // blue
var rgb2 = "rgb(252, 211, 0)"; // yellow
var t = 0.5; // mixing ratio
var mixed = mixbox.lerp(rgb1, rgb2, t);
console.log(mixed);`
It successfully filled the screen with the mix result. But when I tried to add the following code on the main JavaScript
`var z1 = mixbox.rgbToLatent(rgb1);
var z2 = mixbox.rgbToLatent(rgb2);
var z3 = mixbox.rgbToLatent(rgb3);
var zMix = new Array(mixbox.LATENT_SIZE);
for (var i = 0; i < zMix.length; i++) { // mix:
zMix[i] = (0.3z1[i] + // 30% of rgb1
0.6z2[i] + // 60% of rgb2
0.1*z3[i]); // 10% of rgb3
}
var rgbMix = mixbox.latentToRgb(zMix);`
nothing happens. Same thing with Python. I additionally installed Mixbox in a command line, but it couldn't help with code. If you can help me make both of these work, I will be very thankful
The text was updated successfully, but these errors were encountered:
You're getting that error because programiz doesn't recognize mixbox as a library. You need to have mixbox installed from the pip package manager via running the pip install pymixbox command in command line and as python will not come with mixbox. Although I doubt you can do a pip install on programiz or most online python interpreter. But either way, you need to have mixbox installed before you can use it.
For the javascript item, it works for me after I define rgb3. So the following three color mix works for me.
letrgb1='rgb(7,67,153)';//cyanletrgb2='rgb(203,17,132)';//magentaletrgb3='rgb(245,199,1)';//yellowvarz1=mixbox.rgbToLatent(rgb1);varz2=mixbox.rgbToLatent(rgb2);varz3=mixbox.rgbToLatent(rgb3);varzMix=newArray(mixbox.LATENT_SIZE);for(vari=0;i<zMix.length;i++){// mix:zMix[i]=(0.3*z1[i]+// 30% of rgb10.6*z2[i]+// 60% of rgb20.1*z3[i]);// 10% of rgb3}varrgbMix=mixbox.latentToRgb(zMix);
Furthermore, that javascript code of yours might have been copied from the example, but it wouldn't have worked as it is also missing the * after the 0.3 and 0.6. So it should have been
for(vari=0;i<zMix.length;i++){// mix:zMix[i]=(0.3*z1[i]+// 30% of rgb10.6*z2[i]+// 60% of rgb20.1*z3[i]);// 10% of rgb3}
I am having trouble with Mixbox on Programiz, a Python I used the following code.
`import mixbox
rgb1 = (0, 33, 133) # blue
rgb2 = (252, 211, 0) # yellow
t = 0.5 # mixing ratio
rgb_mix = mixbox.lerp(rgb1,rgb2,t)
print(rgb_mix)`
But this is what I recieved.
`ERROR!
Traceback (most recent call last):
File "<main.py>", line 3, in
ModuleNotFoundError: No module named 'mixbox'
=== Code Exited With Errors ===`
Alternatively, I was tying to make Mixbox mix multiple colors work in a JavaScript Compiler. Programiz does that too, but I also used Tynker, since it has an HTML extension. I was able to make the simple usage work on a HTML. This is my code.
`var rgb1 = "rgb(0, 33, 133)"; // blue
var rgb2 = "rgb(252, 211, 0)"; // yellow
var t = 0.5; // mixing ratio
var mixed = mixbox.lerp(rgb1, rgb2, t);
console.log(mixed);`
It successfully filled the screen with the mix result. But when I tried to add the following code on the main JavaScript
`var z1 = mixbox.rgbToLatent(rgb1);
var z2 = mixbox.rgbToLatent(rgb2);
var z3 = mixbox.rgbToLatent(rgb3);
var zMix = new Array(mixbox.LATENT_SIZE);
for (var i = 0; i < zMix.length; i++) { // mix:
zMix[i] = (0.3z1[i] + // 30% of rgb1
0.6z2[i] + // 60% of rgb2
0.1*z3[i]); // 10% of rgb3
}
var rgbMix = mixbox.latentToRgb(zMix);`
nothing happens. Same thing with Python. I additionally installed Mixbox in a command line, but it couldn't help with code. If you can help me make both of these work, I will be very thankful
The text was updated successfully, but these errors were encountered: