Reputation: 461
I want to modify a Gtk.Entry to fit its text width, how can I get the text width?. I've tried setting an average width for each character, but It don't work properly
Upvotes: 3
Views: 660
Reputation: 7153
GTK+ widgets have their rendering layout done by Pango, so first, create a Pango Layout
for your widget by calling create_pango_layout
with the text you want on your Gtk.Entry
and then use get_size
to get the dimensions.
Upvotes: 3