GtkLabel max-width-chars with ellipsize broken?
- From: infirit <infirit gmail com>
- To: "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>
- Subject: GtkLabel max-width-chars with ellipsize broken?
- Date: Sat, 10 Jun 2017 16:55:33 +0200
Hi, I have been trying to use "max-width-chars" with ellipsize on a
label that acts as a page label for a notebook with zero success. It
appears it is completely ignored as whatever I use, -1 to 200 nothing
ever changes how it looks. How it looks is either we only see a single
character with ellipses or just ellipses.
Am I missing something? is this the correct way to force a certain width
on the label?
Thx
~infirit
from gi.repository import Gtk, Pango
class MyWindow(Gtk.Window):
def __init__(self, *args, **kwargs):
super().__init__(default_width=400, default_height=300,
*args, **kwargs)
self.connect("delete-event", Gtk.main_quit)
self.notebook = Gtk.Notebook()
self.add(self.notebook)
for n in (1,2,3):
# We should see the first 20 then ellipse
label_text = "012345678901234567890"
page_label = Gtk.Label(
label_text,
max_width_chars=20,
ellipsize=Pango.EllipsizeMode.END,
halign=Gtk.Align.CENTER)
page_label.set_tooltip_text(label_text)
page_content = Gtk.Image.new_from_icon_name("go-home",
Gtk.IconSize.DIALOG)
self.notebook.insert_page(page_content, page_label, n)
window = MyWindow()
window.show_all()
Gtk.main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]