title: Best way to set Entry Background Color in Python GTK3 and set back to default
body: <p>What is the best way to set background color for one entry and set it back to the default color?</p>
  
  <p>My script is now working but I am very sure this is not the best way.<br>
  Also I still have two problems:</p>
  
  <ol>
  <li>If I insert a text, not containing string "red" or "green" and select this text I cant see my selection because It is all white.</li>
  <li>I think there are better ways then the way I insert <code>self.entry_default_background_color_str</code> into the CSS text. </li>
  </ol>
  
  <hr>
  
  <pre><code>import gi
  gi.require_version('Gtk', '3.0')
  from gi.repository import Gtk
  from gi.repository import Gdk
  
  class Window(Gtk.Window):
  
      def __init__(self):
  
          self.screen = Gdk.Screen.get_default()
          self.gtk_provider = Gtk.CssProvider()
          self.gtk_context = Gtk.StyleContext()
          self.gtk_context.add_provider_for_screen(self.screen, self.gtk_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
  
  
          Gtk.Window.__init__(self, title="Check Input")
          self.set_size_request(300, 80)
          self.mainbox = Gtk.VBox()
          self.add(self.mainbox)
  
          # entry
          self.name_entry      = Gtk.Entry()
          self.name_entry.set_name("name_entry")
          self.mainbox.pack_start(self.name_entry, True, True, 0)
          self.name_entry.connect("changed", self.check_input)
  
          entry_context = self.name_entry.get_style_context()
          self.entry_default_background_color = entry_context.get_background_color(Gtk.StateType.NORMAL)
          self.entry_default_background_color_str = self.entry_default_background_color.to_string()
  
          self.show_all()
  
  
      def check_input(self, _widget=None):        
              if "red" in self.name_entry.get_text():
                  self.gtk_provider.load_from_data('#name_entry { background: red; }')
              elif "green" in self.name_entry.get_text():
                  self.gtk_provider.load_from_data('#name_entry { background: green; }')
              else:
                  self.gtk_provider.load_from_data('#name_entry { background: ' + self.entry_default_background_color_str + '; }')
  
  
  def main():
      window = Window()
      Gtk.main()
  
  
  if __name__ == "__main__":
      main()
  </code></pre>