Please support our Python advertiser: Programming Forums
Views: 237 | Replies: 2
![]() |
•
•
Join Date: Apr 2008
Posts: 4
Reputation:
Rep Power: 0
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?
•
•
Join Date: Jul 2007
Location: Sofia, Bulgaria
Posts: 138
Reputation:
Rep Power: 2
Solved Threads: 10
python Syntax (Toggle Plain Text)
click=0 def button_clicked(): global click click=click+1 print click
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode