Question : Button not getting updated even after setting label

I am changing label of a button , but it is not getting reflected in the application . My whole source code GitHub - redoC-A2k/vtodo: [WIP]: Vala and gtk based todo application . is here .

button_nvim

terminal_vtodo

vtodo

On first printf the output is Button , while for second it is December which is as expected , the problem is that there is not any change in gui label of button of my gtk application . It througout shows button rather than december


This is the highlighted button which I am trying to change

Hi:

I see that you are using ApplicationWindow, so maybe you should use Gtk.Application instead of Gtk.main().

About your problem, have you tried to use “set_label” instead of using an assignation? I know that it should work the same, but just to be sure…

Also, I recommend always to use the full path for classes, so try to use Gtk.Button instead of Button alone.

1 Like

Ok, I found the bug: you are calling twice to builder_init(), so the first time you are setting the label in an object, and then you are creating a new one which is the one that finally is shown in the window.

1 Like

I have solved this problem of mine , this answer gave me a direction python - Cannot change property of GTK button - Stack Overflow

After reading this I saperated my single glade file in two files one with main top level window i.e. ApplicationWindow and another with inner widgets like Box and so on .

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.