Skip to content
Browse files

fixed button bug

  • Loading branch information...
1 parent 6fa1ed2 commit 7a88b661c4bbeaaa987c7d1365c22981987a4e2e @metulburr committed Apr 21, 2014
Showing with 5 additions and 2 deletions.
  1. +1 −0 data/GUI/button.py
  2. +4 −2 data/states/viewer.py
View
1 data/GUI/button.py
@@ -57,6 +57,7 @@ def on_click(self,event):
if not self.call_on_release:
self.function()
+
def on_release(self,event):
if self.clicked and self.call_on_release:
self.function()
View
6 data/states/viewer.py
@@ -30,11 +30,13 @@ def __init__(self, screen_rect):
'font' : tools.Font.load('impact.ttf', 12)
}
self.next_button = button.Button((475,150,100,25),(100,100,100),
- self.switch_card(1), text='Next', **button_config
+ lambda x=1:self.switch_card(x), text='Next', **button_config
)
self.prev_button = button.Button((225,150,100,25),(100,100,100),
- self.switch_card(-1), text='Previous', **button_config
+ lambda x=-1:self.switch_card(x), text='Previous', **button_config
)
+ def callback_test(self):
+ print('callback')
def update_category(self, text):
self.category, self.category_rect = self.make_text(text, (255,255,255), (self.screen_rect.centerx, 162), 15, fonttype='impact.ttf')

0 comments on commit 7a88b66

Please sign in to comment.
Something went wrong with that request. Please try again.