Currently I have this code:
def my_script_function(image, drawable, text_value, int_value) :
pixel = [0,0, 255, 255]
for i in range(1,1600):
for j in range(1,1600):
pdb.gimp_drawable_set_pixel(drawable, i, j, 4, pixel)
#gimp.set_background(02, 100, 255)
pdb.gimp_image_flip( image, ORIENTATION_HORIZONTAL )
return
pdb.gimp_image_flip( image, ORIENTATION_HORIZONTAL )
works fine, however, pdb.gimp_drawable_set_pixel(drawable, i, j, 4, pixel)
returns this error:
Traceback (most recent call last):
File "C:\Program Files\GIMP 2\32\lib\gimp\2.0\python\gimpfu.py", line 699, in response
dialog.res = run_script(params)
File "C:\Program Files\GIMP 2\32\lib\gimp\2.0\python\gimpfu.py", line 361, in run_script
return apply(function, params)
File "C:\Program Files\GIMP 2\lib\gimp\2.0\plug-ins\Example1.py", line 15, in my_script_function
pdb.gimp_drawable_set_pixel(drawable, i, j, 4, pixel)
RuntimeError: execution error
Which, just tells me for some reason it's not running pdb.gimp_drawable_set_pixel(drawable, i, j, 4, pixel)
If you want to try it out, here's the entire script:
#!/usr/bin/env python
from gimpfu import *
# create an output function that redirects to gimp's Error Console
def gprint( text ):
pdb.gimp_message(text)
return
# our script
def my_script_function(image, drawable, text_value, int_value) :
pixel = [0,0, 255, 255]
for i in range(1,1600):
for j in range(1,1600):
pdb.gimp_drawable_set_pixel(drawable, i, j, 4, pixel)
#gimp.set_background(02, 100, 255)
pdb.gimp_image_flip( image, ORIENTATION_HORIZONTAL )
return
# This is the plugin registration function
register(
"my_first_script2",
"Hamburger",
"This script draws some stuff2",
"asdf",
"asdf Company",
"asdf 2015",
"<Image>/MyScripts/My First Python-Fu",
"*",
[
(PF_STRING, 'some_text', 'Some text input for our plugin', 'Write something'),
(PF_INT, 'some_integer', 'Some number input for our plugin', 2010)
],
[],
my_script_function,
)
main()
Is C not python and is invalid python syntax try: