It is currently Sat Jul 06, 2024 8:59 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [SOLVED] Python's gimp_text_fontname won't take -1 as "drawable" arg
PostPosted: Fri Mar 22, 2013 2:24 pm  (#1) 
Offline
GimpChat Member

Joined: Mar 15, 2013
Posts: 36
I am trying to apply gimp_text_fontname in a python plug-in and I want to create a new layer, not a floating layer, and the documentation in the Procedure Browser says I should be able to enter "-1" in the argument for the drawable and this will create a new layer. But this in not working in Python. I get an error message, "TypeError: wrong parameter type".

A possible work-around is gimp_text which is deprecated in preference to this gimp_text_fontname, but I can't figure out the parameters for this older version. Does anyone have a sample argument entries for this older procedure or a solution to the newer procedure?


Last edited by Grafx on Fri Mar 22, 2013 6:11 pm, edited 1 time in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Python's gimp_text_fontname will not take -1 as "drawable" argumen
PostPosted: Fri Mar 22, 2013 4:53 pm  (#2) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
Grafx wrote:
I am trying to apply gimp_text_fontname in a python plug-in and I want to create a new layer, not a floating layer, and the documentation in the Procedure Browser says I should be able to enter "-1" in the argument for the drawable and this will create a new layer. But this in not working in Python. I get an error message, "TypeError: wrong parameter type".

A possible work-around is gimp_text which is deprecated in preference to this gimp_text_fontname, but I can't figure out the parameters for this older version. Does anyone have a sample argument entries for this older procedure or a solution to the newer procedure?

Use None instead:
text_layer = pdb.gimp_text_fontname(image, None, 0, 0, "Test", 0, True, 60, PIXELS, "Sans")


As a general rule, the Python interface uses the objects instead of their ids in most calls, so where -1 is used to indicate "no object" in the Scheme interface, a "None" is very likely to work in the Python interface (yes, the help in the procedure browser is really the Scheme one)

_________________
Image


Last edited by ofnuts on Fri Mar 22, 2013 4:57 pm, edited 1 time in total.

Top
 Post subject: Re: Python's gimp_text_fontname will not take -1 as "drawable" argumen
PostPosted: Fri Mar 22, 2013 4:55 pm  (#3) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
I think you pass it NIL or NULL or None -- whatever Python's non-object is.

:ninja

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Python's gimp_text_fontname will not take -1 as "drawable" argumen
PostPosted: Fri Mar 22, 2013 6:10 pm  (#4) 
Offline
GimpChat Member

Joined: Mar 15, 2013
Posts: 36
Applying None did it. Strange, I was sure I tried None. Maybe I tried "None" using quotes.

Thanks all.


Top
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) manipulate a portion of text inside a text layer using python-fu

2

No new posts How to make a python or scrip fue from text

2

No new posts Eager to learn to input text in python script (Solved)

2

No new posts Convert GIMP plugin from Python 2 to Python 3

4

No new posts Difference between "Python-Fu" and "Python" plugin

6



* Login  



Powered by phpBB3 © phpBB Group