certifi==2017.11.5
chardet==3.0.4
Cython==0.26.1
docutils==0.14
idna==2.6
Kivy==1.10.0
Kivy-Garden==0.1.4
pygame==1.9.3
Pygments==2.2.0
requests==2.18.4
urllib3==1.22
I created a simple app. Below is the code:
I have two buttons - Heads and Tails and depending on which button is clicked the label text is set.
Scenario: If I have clicked on heads, the label shows 'heads'. Next if I click the 'tails' button, it still clicks heads.
I have to click on the 'tails' button several times till it detects it. Why is this so ?
Is this expected ? Or am I missing something in my setup/config/code?
=========================cointoss.py =================================
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
class CoinTossBoxLayout(BoxLayout):
def choice(self, guess):
self.ids.result.text = 'You clicked the %s button!' % guess
class CoinTossApp(App):
def build(self):
return CoinTossBoxLayout()
if __name__ == '__main__':
CoinTossApp().run()
====================cointoss.kv ======================
<CoinTossBoxLayout>:
orientation: 'vertical'
Label:
text: 'Welcome to the Heads or Tails!'
font_size: 50
BoxLayout:
orientation: 'horizontal'
Button:
text: 'Heads'
on_release: root.choice('heads')
Button:
text: 'Tails'
on_release: root.choice('tails')
Label:
id: result
text: ''
font_size: 40===================================================