I am just beginner in kivy and object oriented programming.
I have been practicing this code as a combination of the tutorials here:
from kivy.uix.be
class ImageButton(ButtonBehavior,FloatLayout, Image):
Don't inherit from multiple widgets (in this case FloatLayout and Image), this will lead to some weird bugs.
As for your specific problem, the ButtonBehavior is a parent class of the ImageButton which is the root widget and fills the screen. For this reason, the whole screen is a button, though you clearly intended otherwise.
Is the following more like what you wanted? You can also just use a FloatLayout instead of creating the new RootWidget class, I just did this to fit with what you already wrote.
from kivy.uix.behaviors import ButtonBehavior
from kivy.uix.image import Image
from kivy.lang import Builder
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
class RootWidget(FloatLayout):
pass
class ImageButton(ButtonBehavior, Image):
def on_press(self):
print ('pressed')
Builder.load_string("""
<RootWidget>:
ImageButton:
source:'resizedA.png'
size_hint: .2, .2
""")
class The_AssignmentApp(App):
def build(self):
return RootWidget()
if __name__ == "__main__":
The_AssignmentApp().run()