| | |
count how often a button is clicked python/tk
![]() |
•
•
Join Date: Apr 2008
Posts: 4
Reputation:
Solved Threads: 0
Hi,
I wanted to ask if somebody could help me on the following problem:
I want to check how often a button in python/tk is clicked.
I tried the folowing but it doesn't work:
but this won't work because the variable click in the function is different(local) to the
variable outside of the function.
Any suggestions?
I wanted to ask if somebody could help me on the following problem:
I want to check how often a button in python/tk is clicked.
I tried the folowing but it doesn't work:
python Syntax (Toggle Plain Text)
click=0 def button_clicked(): click=click+1 print click
but this won't work because the variable click in the function is different(local) to the
variable outside of the function.
Any suggestions?
python Syntax (Toggle Plain Text)
click=0 def button_clicked(): global click click=click+1 print click
![]() |
Other Threads in the Python Forum
- Previous Thread: dynamic libraries and distutils
- Next Thread: Multiple tasks in Tkinter
| Thread Tools | Search this Thread |
abrupt alarm ansi anti approximation assignment avogadro backend beginner binary bluetooth calculator character cmd code customdialog cx-freeze data decimals dictionaries dictionary directory dynamic error examples exe file float format function gnu graphics gui halp heads homework http ideas import input java launcher leftmouse line linux list lists loop module mouse number numbers output parsing path pointer port prime programming progressbar projects push py2exe pygame pyglet pyqt python random recursion schedule screensaverloopinactive script scrolledtext sqlite statistics string strings sudokusolver sum table terminal text thread threading time tlapse tricks tuple tutorial twoup ubuntu unicode urllib urllib2 variable ventrilo wikipedia write wxpython xlib





