Python + GTK - How to suppress warnings
gtk, pygtk, python
Solution
import warnings
warnings.filterwarnings("ignore")
to unfilter:
warnings.filterwarnings("default")
Problem
When I launch my python program, the terminal floods with: ``` rcGUI.py:331: Warning: Attempt to add property GtkSettings::gtk-label-select-on-focus after class was initialised label1 = gtk.Label("Current tools configured:") rcGUI.py:286: Warning: Attempt to add property GtkSettings::gtk-scrolled-window-placement after class was initialised scroll_window = gtk.ScrolledWindow() rcGUI.py:291: DeprecationWarning: use gtk.TreeView infoList = gtk.CList(2, ["Tool" , "Version"]) rcGUI.py:291: Warning: Attempt to add property GtkSettings::gtk-button-images after class was initialised infoList = gtk.CList(2, ["Tool" , "Version"]) rcGUI.py:217: Warning: Attempt to add property GtkSettings::gtk-can-change-accels after class was initialised toolCombo = gtk.combo_box_entry_new_text() rcGUI.py:217: Warning: Attempt to add property GtkSettings::gtk-menu-popup-delay after class was initialised toolCombo = gtk.combo_box_entry_new_text() rcGUI.py:217: Warning: Attempt to add property GtkSettings::gtk-menu-popdown-delay after class was initialised toolCombo = gtk.combo_box_entry_new_text() rcGUI.py:217: Warning: Attempt to add property GtkSettings::gtk-entry-select-on-focus after class was initialised toolCombo = gtk.combo_box_entry_new_text() rcGUI.py:217: Warning: Attempt to add property GtkSettings::gtk-entry-password-hint-timeout after class was initialised toolCombo = gtk.combo_box_entry_new_text() ``` Interesting enough, my users running it in KDE do not get all those warnings (except the deprecation one), but those in GNOME do. So I think the easiest approach is to suppress all those warnings. I just haven't been able to find out how yet.