LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Python/Gtk3: dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK) (https://www.linuxquestions.org/questions/programming-9/python-gtk3-dialog-add_button-gtk-stock_ok-gtk-responsetype-ok-4175514172/)

RockDoctor 08-10-2014 07:39 PM

Python/Gtk3: dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK)
 
The code
Code:

dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK)
works just fine, and does exactly what I want, but it's apparently depricated, as shown by these warnings:
Quote:

partition_generator_0.4.py:94: Warning: The property GtkButton:use-stock is deprecated and shouldn't be used anymore. It will be removed in a future version.
dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK)
partition_generator_0.4.py:94: Warning: The property GtkSettings:gtk-button-images is deprecated and shouldn't be used anymore. It will be removed in a future version.
dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK
So what's the accepted replacement to achieve the same functionality?

a4z 08-12-2014 01:22 AM

you can find here some notes
https://docs.google.com/document/d/1...PqKAppCY8o/pub

the samples are c,
bug things like
Code:

Old:

button = gtk_button_new_from_stock (GTK_STOCK_SAVE);

New:

button = gtk_button_new_with_mnemonic (_(“_Save”));

should be not to hard to translate into python


and I agree that the gtk documentation, which is often limited to
Quote:

.... deprecated since version x.xx and should not be used in newly-written code.
is poor, there should be a link to a migration guid and to the new ways of doing it

RockDoctor 08-12-2014 07:37 AM

1 Attachment(s)
I had basically done what you suggested
Code:

dialog.add_button("_OK", Gtk.ResponseType.OK)
which gives me the button on the left with text but no image.


All times are GMT -5. The time now is 05:34 PM.