GNOME Calculator and GTK’s Entry

Recently GNOME Calculator has gained a library for math expression parsing and calculation, as a parallel effort to the one used internally for the application, called GCalc.

While GCalc allows to take a string to create an object oriented representation of it and can perform multi-precision calculations, this feature was unable to be used outside, just VDA is using it for math expression parsing, but no-more, yet.

In order to expose GCalc features to user oriented applications, now a new library called GCi was added. GCi provides, for now, a controller for GTK Entries.

GTK Entries controller in GCi, can add calculation features to your Entry. Once you have created a GCi.EntryController and set its entry property to the one in your UI application, a secondary icon using a calculator is added, while allows your users to  write =8*2+1, hit enter or click on the secondary icon and the math expression is replaced by its calculation result (and yes you should use = in order to establish it as a math expression to replace).

Author: despinosa

Linux and GNOME user, full time, since 2001. Actual maintainer of GXml and contributor to other projects mainly on GObject Introspection support.

3 thoughts on “GNOME Calculator and GTK’s Entry”

  1. FYI: In The GIMP I can simply tripe in any numerical fields something like “8*2+1”. No need for the “=” at the beginning or the calc icon Just leaver the field and The GIMP des the calculation. You can even enter “1cm+10px” and it does the conversation for you.

Leave a Reply to Tobias Cancel reply

Your email address will not be published. Required fields are marked *