Function Result of Python in GIMP 2.99.7

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)>
> >>>
_______________________________________________
gimp-developer-list mailing list
List address:    gimp-developer-list@xxxxxxxxx
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list



[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux