I would like to place buttons at different coordinates using GTK4 UI files. For this I use GTKFixed containers. From what I understand, to indicate the position of the buttons, I have to use the keyword “layout”. However, “x” and “y” are not recognized for the coordinates.
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkApplicationWindow" id="main_window">
<property name="default-width">1050</property>
<property name="default-height">700</property>
<property name="resizable">false</property>
<child>
<object class="GtkFixed">
<child>
<object class="GtkButton">
<property name="label">button1</property>
<layout>
<property name="x">10</property>
<property name="y">200</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">button2</property>
<layout>
<property name="x">400</property>
<property name="y">750</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</interface>
For information, I managed to place a button at the correct coordinates with the following Python code. However, I would like to do everything in the UI XML files.
my_fixed_container.put(button1, 10, 200)
Thank you in advance for your help.