Layout

Basic layout with GTK+-based applications uses a familiar vertical and horizontal box model. Go-GTK (as a straightforward binding to this API) exposes this same functionality. We lay out the GoMail main window using a vertical box to position the menu and toolbar above the main content. Our main content is then a horizontally split pane created with gtk.NewHPaned() (where H refers to the horizontal layout, not the bar orientation, which is vertical). Before looking at the details, here's the basic layout code for the main window. The toolbar and menu creation code is omitted for brevity but can be found in the example code repository:

package mainimport "github.com/mattn/go-gtk/gtk"const padding = 3func main() {   gtk.Init(nil) window ...

Get Hands-On GUI Application Development in Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.