Robin Theunis
Robin Theunis

Reputation: 93

How to set a fixed windows size for a GTK+ app in C?

How do I set a fixed window size for a GTK+ app? I have:

gtk_window_set_default_size(GTK_WINDOW(mainWindow), 400, 300);
gtk_window_set_policy (GTK_WINDOW(mainWindow), FALSE, FALSE, FALSE);

but the window gets very small. There are no widgets yet.

Upvotes: 9

Views: 22017

Answers (2)

dhanesh sr
dhanesh sr

Reputation: 121

gtk_widget_set_size_request(mainWindow, 400, 300);
gtk_window_set_resizable (GTK_WINDOW(mainWindow), FALSE);

This must solve the problem.

Upvotes: 4

DReJ
DReJ

Reputation: 1974

Use gtk_window_set_resizable function for this purpose

gtk_window_set_default_size(GTK_WINDOW(mainWindow), 400, 300);
gtk_window_set_resizable (GTK_WINDOW(mainWindow), FALSE);

Upvotes: 10

Related Questions