Closed roipoussiere closed 5 years ago
You should use window.SetSizeRequest instead (for GTK2). You can confirm this is default behavior of GTK2.
#include <gtk/gtk.h>
int
main(int argc, char* argv[]) {
GtkWidget* window;
GtkWidget* label;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(window), "delete-event", gtk_main_quit, window);
label = gtk_label_new_with_mnemonic("Hello World");
gtk_container_add(GTK_CONTAINER(window), label);
gtk_window_set_default_size(GTK_WINDOW(window), 640, 480);
gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
gtk_window_set_modal(GTK_WINDOW(window), TRUE);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
Here is an Hello World program:
although I use
win.SetDefaultSize(600, 400)
, the window is cropped to the size of the content (HelloWorld label), resulting a tiny window.I wrote an equivalent program that uses https://github.com/gotk3/gotk3 and the window are sized correctly.
I run go 1.12.4 on Linux Manjaro/i3.