hehe, i didn't actually pay attention to the what the code was doing.
But yeah now that i look at it... ofnuts version would work much nicer.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Hello World in GIMP Python
from gimpfu import *
with open("/home/master/.gimp-2.8/plug-ins/1.txt") as f:
choices=[line.strip() for line in f]
def hello_world33(option) :
#don't need to read this file anymore
#f = open("/home/master/.gimp-2.8/plug-ins/1.txt", 'r')
img = gimp.Image(1, 1, RGB)
pdb.gimp_context_push()
layer = pdb.gimp_layer_new(img, 2480, 3508, 0, "new", 100, 0)
img.resize(layer.width, layer.height, 0, 0)
background = gimp.Layer(img, "Background", layer.width, layer.height, RGB_IMAGE, 100, NORMAL_MODE)
background.fill(BACKGROUND_FILL)
img.add_layer(background, 1)
gimp.Display(img)
gimp.displays_flush()
pdb.gimp_context_pop()
#don't need to read this file anymore
#strings = f.readlines()
#old code
# layer3 = pdb.gimp_text_fontname(img, None, 1, 1, strings[int(num)], 0, True, 60, PIXELS, "URW Palladio L Bold")
layer3 = pdb.gimp_text_fontname(img, None, 1, 1, choices[option], 0, True, 60, PIXELS, "URW Palladio L Bold")
pdb.gimp_text_layer_resize(layer3, 1140, 600)
drawable = img.active_drawable
print()
register(
"python_fu_hello_world33",
"1",
"2",
"3",
"4",
"5",
"start",
"", # Create a new image, don't work on an existing one
[
(PF_OPTION, "text", "Text", 0,choices),
#(PF_SPINNER, "num", "Number strong", 5, (1,end,1)),
],
[],
hello_world33, menu="<Image>/File/Create")
main()
It's also nicer in this version because you get to see what line of text you're choosing instead of just selecting the index (where you're kind'a blind unless you have the text file opened).