slashcrack
slashcrack

Reputation: 123

PyGTK object that displays text

I am searching for a GTK Object that displays a text (only one line), but I need the text to be bigger than in a Statusbar (and maybe that I can change the font and italic/bold etc).

Normally, I created a GTKStatusbar that displays a text when I click on a button. (I created the program with Glade):

self.statusbar = self.builder.get_object("statusbar")
self.searchbutton = self.builder.get_object("searchbutton")

def on_searchbutton_clicked(self, widget):
    self.statusbar.push(1, "Hello world!")

But with this method I can't display the text with a bigger letter size.

Can you please help me with my problem?

Thanks in advance.

Upvotes: 0

Views: 851

Answers (1)

Micah Carrick
Micah Carrick

Reputation: 10187

A Gtk.Label has a property called "use-markup" which lets you use Pango Text Markup in the label. For example:

label = Gtk.Label()
label.set_use_markup(True)
label.set_markup("<big>This is bigger text</big>")

You could either use the GtkLabel as the statusbar (for a very, very simple statusbar) or you could extend GtkStatusbar and pack your label into it there.

Upvotes: 1

Related Questions