Sample text preview in Gtk.FontChooserDialog

Hello,

I use the Gtk3 Gtk.FontChooserDialog to select fonts in my Python application.

I create the gui using Glade on Ubuntu 20.04, which supports up to Gtk 3.24.

I can see from this page: Gtk.FontChooserDialog - Classes - Gtk 3.0

That the picture of the FontChooserDiaglog on that page displays each font using the user preview text string and the font name ( as smaller text ) above it.

In my FontChooserDiaglog, this does not seem to be possible, and each font text is just the font name ( it does not use the preview text string ).

Is this something which was introduced in a later version of Gtk, or am I missing something ?

Thanks for any help you can offer :slight_smile:

Maybe the screenshot is dated and for an older GTK 3 version than yours? I have 3.24.34 here and the dialog looks like this in GTK 3 apps:

The preview text is underneath the font list. It is editable by the user. You can do dialog.set_preview_text('This is a test') before running dialog.run() to set the text you want to show there.

Thanks for the prompt

reply, I can set the preview text.

It’s the font sample preview ? that I can’t set. I’ve attached an image to show.

Many thanks.

I meant in my screenshot the “The quick brown fox jumps over the laz…” text underneath the list of fonts. That is the preview text. It renders in the font the user clicks.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.