[Gimp-developer] Function Result of Python in GIMP 2.99.7
- From: ShiroYuki Mot <shiroyuki mot mail gmail com>
- To: gimp-developer <gimp-developer-list gnome org>, Jehan Pagès <jehan marmottard gmail com>
- Subject: [Gimp-developer] Function Result of Python in GIMP 2.99.7
- Date: Wed, 8 Sep 2021 17:41:18 +0900
Sometimes we can get the value as ResultTuple in GIMP 2.99.
When we write a Python Script, Is it OK using a hard cording '[1]' after
the function in order to get the real value?
(ex. col_1=Gimp.context_get_foreground()[1] )
(If in GIMP 2.10, col_0=gimp.context_get_foreground() )
Perhaps, currently it is worthwhile, but how about the future?
(In the future, will the syntax be changed to get not the Tuple but the
value? Or is this already a specification determined/fixed? )
And I am a bit confusing that the result is 'ResultTuple by Gimp class'
and/or 'ValueArray by pdb-calling'.
col=Gimp.context_get_foreground()
col
(True, foreground=<Gimp.RGB object at 0x000001e6cc0859a0 (GimpRGB at
0x000001e6cbe9ac10)>)
type(col)
<class '__main__._ResultTuple'>
col[1]
<Gimp.RGB object at 0x000001e6cc0859a0 (GimpRGB at 0x000001e6cbe9ac10)>
col_1=Gimp.context_get_foreground()[1]
col_1
<Gimp.RGB object at 0x000001e6cc085820 (GimpRGB at 0x000001e6cbe9aca0)>
type(col_1)
<class 'gi.repository.Gimp.RGB'>
col_pdb = Gimp.get_pdb().run_procedure('gimp-context-get-foreground',
[ ])
col_pdb
<Gimp.ValueArray object at 0x000001e939e99280 (GimpValueArray at
0x000001e939722820)>
type(col_pdb)
<class 'gi.repository.Gimp.ValueArray'>
col_pdb.index(1)
<Gimp.RGB object at 0x000001e939e990a0 (GimpRGB at 0x000001e93be021c0)>
col_pdb = Gimp.get_pdb().run_procedure('gimp-context-get-foreground',
[ ]).index(1)
col_pdb
<Gimp.RGB object at 0x000001e939e992e0 (GimpRGB at 0x000001e93be019e0)>
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]