Advertisement
gr4viton

kivy imagebutton

Oct 24th, 2015
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. Gives me "Invalid class name" on <ImageButton> .kv line
  2. #.py
  3.  
  4. from kivy.uix.behaviors import ButtonBehavior
  5. #..
  6.  
  7. class ImageButton(ButtonBehavior, Image):
  8.     pass
  9.  
  10.  
  11. class StepWidget(GridLayout):
  12.  
  13.     def __init__(self, **kwargs):
  14.         super(StepWidget, self).__init__(**kwargs)
  15.         #...
  16.     def pressed(self):
  17.         print('hooooray')
  18.  
  19. #.kv
  20. # button behavior example: http://stackoverflow.com/questions/24668317/kivy-clickable-image-that-replaced-a-button
  21.  
  22. <StepWidget>:
  23.     size_hint_x: '1'
  24.     cols: 1
  25.     <ImageButton>:
  26.         on_press: root.pressed()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement