title: Kivy Making a Custom TreeViewNode
body: <p>I'm attempting to create a custom TreeViewNode to use with a TreeView.
  Just want an image with a label next to it, nothing more.</p>
  
  <p>Yet attempting to create a custom node... even replicating how it's done in the source doesn't yield the same results.</p>
  
  <p>TreeViewlabel is literally just a class declaration with a comment in it</p>
  
  <pre><code>class TreeViewLabel(Label, TreeViewNode):
  '''there's just a comment here'''
  </code></pre>
  
  <p>This is my version of the TreeViewLabel for comparison</p>
  
  <pre><code>class TreeViewImageLabel(Label, TreeViewNode):
  """oh boy this is a comment"""
  </code></pre>
  
  <p>Well attempting to create a carbon copy of this code and adding it to a tree yields the following. My version is the first label, and the subsequent labels are the default TreeViewLabel
  <a href="https://i.imgur.com/qtQ15P5.jpg" rel="nofollow noreferrer"><img src="https://i.imgur.com/qtQ15P5.jpg" alt="enter image description here"></a></p>
  
  <p>It's all spaced out, un-aligned and huge. Nothing as neat and tidy as the TreeViewLabel that comes with kivy.</p>
  
  <p>What the heck is going on? Not only does it look nothing like the TreeViewLabel, but attempting to configure the widget with size, size_hints, pos, etc. does nothing to budge that label from where it is relative to the tree.</p>
  
  <p>My original plan was to have my node inherit from a boxlayout with an image and label stuck in it, but with the sizing of custom nodes it's impossible to get anything that looks like a TreeViewNode given what I know right now.</p>
  
  <h2>The solution was found</h2>
  
  <p>So this is how it looks with the fix implemented:
  <a href="https://i.stack.imgur.com/rYnzw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rYnzw.jpg" alt="enter image description here"></a></p>
  
  <p>For anyone else looking to make a TreeViewNode with a picture and label as I've done, this is the code that got it working:</p>
  
  <pre><code>#python
  class TreeViewImageLabel(BoxLayout, TreeViewNode):
      pass
  </code></pre>
  
  <p>And the .kv </p>
  
  <pre><code>#kivy language
  &lt;TreeViewImageLabel&gt;:
  height: max(lbl.texture_size[1] + dp(10), dp(24))
  
      Image:
          size: (max(lbl.texture_size[1] + dp(10), dp(24)), max(lbl.texture_size[1] + dp(10), dp(24)))
          size_hint: (.05, 1)
          id:img
          source: "smiley.png"
      Label:
          size_hint: (.9, 1)
          id:lbl
          text_size: self.width, None
          text: "test"
  </code></pre>