GtkButton change text

I have an application with a Glade GUI, I have a Gtkframe with a GTkbutton in. I can change the label on the frame, but I want to change the text on the button depending on user input. I have done this before but I’ve forgotten how. (I think I was using Gtk but it might have been Qt).

I have read the documentation and the guide linked to on this site. Changing the frame label works:
self.labelStartTitle.set_label(‘Process’)
Changing the button label doesn’t:
self.buttonStart.set_label(‘Process’)
Error: “AttributeError: ‘function’ object has no attribute ‘set_label’”
Could someone jog my memory?

'self.buttonStart' is not a 'Gtk.Button' object.

Please double-check your code.

I was going by what Glade calls it.
g

How did you set self.buttonStart?

We don’t have enough information to help you, as we’re missing a lot of context that only you have.

Good point! However I’ve just realised I had made a silly mistake and forgot to copy a new version of the Glade file to where the Python expects to find it - duh! All working as expected now.

I’m also pleased to have found somewhere to get constructive help with Glade after much searching.

2 Likes

If you are using Glade, try using the latest versions ( 3.38.1 currently ). Lots of bug fixes have gone in to recent versions. I use Glade flatpak nightly so you get the fixes the next day.

For more info https://glade.gnome.org

Thanks.

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