title: Kivy Config.read not working properly when using Window.bind from within another class
body: <p>i just discovered a bug and am trying to find a solution. This is my folder structure:</p>
  <pre><code>|- root
    |- GUI.py
    |- GUI.ini
    |- layouts
      |- root.kv
      |- style.kv
    |- lib
      |- kivy_utils.py
    |- static
      |- icon.ico
      |- Barlow-Regular.ttf
      |- Barlow-Bold.ttf
  </code></pre>
  <p>The GUI.py is my starting point for launching the GUI and looks like this:</p>
  <pre><code># %% standard python library imports
  import os
  
  # %% kivy imports
  # import kivy
  from kivy.app import App
  from kivy.core.window import Window
  from kivy.config import Config
  from kivy.lang import Builder
  from kivy.uix.boxlayout import BoxLayout
  
  # %% lib imports
  from lib.kivy_utils import TTLabel
  
  # read &amp; overrule config
  Config.read(os.path.join(os.path.dirname(os.path.abspath(__file__)), &quot;GUI.ini&quot;))
  Window.size = Config.getint(&quot;graphics&quot;, &quot;width&quot;), Config.getint(&quot;graphics&quot;, &quot;height&quot;)
  
  # read kv language files
  for kv in [&quot;root.kv&quot;, &quot;style.kv&quot;]:
      Builder.load_file(&quot;layouts&quot; + os.sep + kv)
  
  class Root(BoxLayout):
      &quot;&quot;&quot; Main Root class for callbacks, UI building etc.&quot;&quot;&quot;
      def __init__(self):
          super().__init__()
  
      def test_function(self):
          print(&quot;K TEST&quot;)
  
  
  class Launcher(App):
      &quot;&quot;&quot;Supplementary Launcher class&quot;&quot;&quot;
  
      def build(self):
          return Root()
  
      def on_pause(self):
          return True
  
  
  if __name__ == &quot;__main__&quot;:
      Launcher().run()
  </code></pre>
  <p>I want to use the kivy_utils.py for custom classes, such as scalable widgets, tooltips etc.:</p>
  <pre><code>from kivy.properties import BooleanProperty, ObjectProperty, NumericProperty
  from kivy.core.window import Window
  from kivy.uix.button import Button
  from kivy.uix.label import Label
  from kivy.uix.slider import Slider
  from kivy.uix.switch import Switch
  from kivy.clock import Clock
  
  class Tooltip(Label):
      pass
  
  
  class HoverBehavior(object):
      &quot;&quot;&quot;Hover behavior.
      :Events:
          `on_enter`
              Fired when mouse enter the bbox of the widget.
          `on_leave`
              Fired when the mouse exit the widget
      &quot;&quot;&quot;
  
      hovered = BooleanProperty(False)
      border_point = ObjectProperty(None)
  
      def __init__(self, **kwargs):
          self.register_event_type('on_enter')
          self.register_event_type('on_leave')
          Window.bind(mouse_pos=self.on_mouse_pos)  # for recognizing tooltips
          super(HoverBehavior, self).__init__(**kwargs)
  
      def on_mouse_pos(self, *args):
          if not self.get_root_window():
              return
          pos = args[1]
          inside = self.collide_point(*self.to_widget(*pos))  # compensate for relative layout
          if self.hovered == inside:
              return
          self.border_point = pos
          self.hovered = inside
          if inside:
              self.dispatch('on_enter')
          else:
              self.dispatch('on_leave')
  
      def on_enter(self):
          pass
  
      def on_leave(self):
          pass
  
  
  class TTLabel(HoverBehavior, Label):
      &quot;&quot;&quot;Resizable Label with Tooltip on top of Label and HoverBehaviour class&quot;&quot;&quot;
  
      def __init__(self, **kwargs):
          super().__init__()
          self.tooltip = None  # Attribute set in kv file
          self.header = None  # Attribute set in kv file
          self.tooltip_wdg = Tooltip()
          Window.bind(on_resize=self.on_window_resize)  # binds font_size rescaling function to on_resize event
          Clock.schedule_once(self.on_window_resize, 1.5)  # called once at init cuz widget hasnt final size yet
  
      def on_enter(self):
          &quot;&quot;&quot;Event fires when entering widget&quot;&quot;&quot;
          if self.tooltip:  # only binds event if tooltip variable is set
              Window.bind(mouse_pos=lambda w, p: setattr(self.tooltip_wdg, 'pos', p))  # binds position to cursor
              self.tooltip_wdg.text = self.tooltip  # sets text to tooltip variable
              Window.add_widget(self.tooltip_wdg)
  
      def on_leave(self):
          &quot;&quot;&quot;Event fires when leaving widget&quot;&quot;&quot;
          if self.tooltip:
              Window.remove_widget(self.tooltip_wdg)
  
      def on_window_resize(self, *args):
          &quot;&quot;&quot;Event fires when window is rescaled&quot;&quot;&quot;
          fire_refresh = True
  
          # # Fires when horizontal size is too small
          if self.size[0] &lt; self._label.size[0]:
              fire_refresh = False
              self.texture_size[0] = self.size[0]  # reduce texture size to widget size
              if self.size[1] &lt; self._label.size[1]:  # additionally, if vertical size is too small, reduce aswell
                  self.texture_size[1] = self.size[1]
                  return
  
          # Fires when vertical size is too small
          if self.size[1] &lt; self._label.size[1]:
              fire_refresh = False
              self.texture_size[1] = self.size[1]
              if self.size[0] &lt; self._label.size[0]:
                  self.texture_size[0] = self.size[0]
                  return
  
          # Fires when widget size &gt; texture size  # TODO: is there another way not to fire all the time?
          if fire_refresh:
              self.texture_update()
  
  </code></pre>
  <p>And finally, my root.kv looks like this:</p>
  <pre><code>&lt;Root&gt;:
      BoxLayout:
          orientation: 'horizontal'
          Button:
              text: &quot;Test button&quot;
              on_release: root.test_function()
          TTLabel:
              text: &quot;Test label with tooltip&quot;
              tooltip: &quot;Also WOW!&quot;
  </code></pre>
  <p>So now to my actual problem: The code works, however(!) the <code>Config.read</code> command in my <code>GUI.py</code> file is not &quot;refreshing&quot; the current Config - the load works, i can access the attributes via <code>Config.get</code>, use <code>Config.write</code> etc - the .ini file gets updated, but the changes are not realized. Now i was thinking to manually refresh the parameters from the config (e.g. <code>Window.size = Config.getint(&quot;graphics&quot;, &quot;width&quot;), Config.getint(&quot;graphics&quot;, &quot;height&quot;)</code>), but i want to use the Options menu (F1) and there must be another way i am sure. The problem occures as soon as i use <code>Window.bind</code> from within my <code>kivy_utils.py</code>. I tried loading the Config there, use <code>self.get_root_window</code> instead of <code>Window</code>, putting the <code>Config.read</code> command in various places in the <code>kivy_utils.py</code> etc. What am i missing?</p>