Created
September 11, 2013 23:45
-
-
Save ptomato/6531362 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Gtk = imports.gi.Gtk; | |
Gtk.init(null); | |
let w = new Gtk.Window({ | |
default_width: 800, | |
default_height: 600 | |
}); | |
let g = new Gtk.Grid(); | |
let frame = new Gtk.Frame({ expand: true }); | |
let label = new Gtk.Label({ | |
// Uncomment this to improve the behavior, but not fix it entirely; in | |
// passing, this shows that max_width_chars is not working properly either | |
// max_width_chars: 1, | |
wrap: true, | |
expand: true, | |
label: 'AAAAA AAAAA AAAAA AAAAA AAAA AAAAA AAAAA AAAAA' | |
}); | |
let frame2 = new Gtk.Frame({ expand: true }); | |
g.add(frame); | |
g.add(label); | |
// Add frame2 instead of label, to see the expected behavior of two "expand" | |
// widgets in a grid: both are the same size | |
w.add(g); | |
// The problem can actually be fixed using a Gtk.SizeGroup | |
// let sg = new Gtk.SizeGroup({ mode: Gtk.SizeGroupMode.HORIZONTAL }); | |
// sg.add_widget(frame); | |
// sg.add_widget(label); | |
w.show_all(); | |
w.connect('destroy', Gtk.main_quit); | |
Gtk.main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This looks awesomely minimal!!
Reading about GtkSizeGroup now...