Kivy Screen class bug
<p>For some reason in kivy when you create a screen class and add a widget to it, specifically an image you get an image 10x bigger than the original for some reason compared to when you make a widget class and add that widget class as a child to the screen class. Here is my code for the kv file: </p>

<pre><code>&lt;StartScreen&gt;
    # Start Screen
    name:'Start'
    orientation: 'vertical'
    FloatLayout:
    id: Start_Layout
        Image:
            id: Start_Background
            source: r'Images\Battle.jpg'
            keep_ratio: True
            allow_stretch: True
            size: root.size

&lt;MainScreen&gt;
    name: 'Main'
    orientation: 'vertical'
    FloatLayout:
        Image:
            source: r'Images\Button.png'
            allow_stretch: True
            keep_ratio: False
            size: 100, 100
</code></pre>

<p>and for the python gui file...</p>

<pre><code>from kivy.uix.widget import Widget
from kivy.uix.image import Image
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.animation import Animation
from kivy.uix.screenmanager import ScreenManager, Screen

from kivy.clock import Clock

from kivy.graphics.context_instructions import Color
from kivy.graphics.vertex_instructions import *

from kivy.core.window import Window

from kivy.app import App

from kivy.lang import Builder

import kivy

kivy.require('1.9.1')

VERSION = '1.9.1'


class GenericButton(Widget):
    Builder.load_file('Button.kv')
    def __init__(self, **kwargs):
        super(GenericButton, self).__init__(**kwargs)
        self.Button = self.ids['Button']
        self.size = Window.size

    def on_touch_down(self, touch):
        self.Button.source = r'Images\ButtonPressed.png'

    def on_touch_up(self, touch):
        self.Button.source = r'Images\Button.png'

class wid(Widget):
    def __init__(self, **kwargs):
        super(wid, self).__init__(**kwargs)
</code></pre>

<p>self.Button = Image(source='Images\Animatio\glow.gif',       allow_stretch=False, keep_ratio=True) (pretend its indented cus im new and it wouldn't let me add it to the code block)
            self.add_widget(self.Button)</p>

<pre><code>class StartScreen(Screen):
    def __init__(self, **kwargs):
        super(StartScreen, self).__init__(**kwargs)
        #self.Layout = self.ids['Start_Layout']
        #self.size = Window.size
    #self.Layout.add_widget(GenericButton())
    #self.ids['Start_Button'] = self.Layout.children[0]
    print self.ids
   #print self.ids.Start_Button.size
    print self.size[0]/2, self.size[1]/2

class MainScreen(Screen):
    def __init__(self, **kwargs):
        super(MainScreen, self).__init__(**kwargs)
        self.size = Window.size

    def on_touch_down(self, touch):
        self.Button.source = r'Images\ButtonPressed.png'


    def on_touch_up(self, touch):
        self.Button.source = r'Images\Button.png'


class ScreenManager(ScreenManager):
    def __init__(self, **kwargs):
        super(MCGMScreenManager, self).__init__(**kwargs)
        Builder.load_file('Gui.kv')
        self.add_widget(StartScreen())
        self.add_widget(MainScreen())
</code></pre>

<p>And the app runs in the main file which i dont see a need to post. But an important thing might be that the app root class is ScreenManager</p>

<p>edit: i messed around a bit and i did this in python but i cleared the children of GenericButton and added the button that GenericButton used to own as a child of StartScreen and same result, a huge unresponsive image.</p>

<pre><code>&lt;MainScreen&gt;
    name: 'Main'
    orientation: 'vertical'
    FloatLayout:
        Image:
            source: r'Images\Button.png'
            allow_stretch: True
            keep_ratio: False
            size: 100, 100
</code></pre>

<p>I didn't check if it's causing your particular issue, but the Image here doesn't take size 100, 100 because its parent (FloatLayout) is a layout class that automatically sets the size and position of its children. In this case, Image will automatically be resized to fill the FloatLayout.</p>

<p>To prevent this, add <code>size_hint: None, None</code> to the Image, to disable automatic resizing in both the horizontal and vertical directions. This generally applies whenever you add something to a Layout.</p>

python kivy kivy-language