Velocity Reviews

Velocity Reviews (
-   Python (
-   -   Button Clicked? (

RiNo 12-09-2012 09:45 AM

Button Clicked?
Hello everyone,

I have a question:

How can a button's function run only when the button is clicked?
I am using tkinter.

All I want is to import(give me) the data from the user and do it with some buttons something like:

Button1==> Keys
Button2==> Give/Ghange Position
Button3==> Find Keys
Button4==> Kitchen

So, I want when the user click on Button1(Keys)..When choose if he want to give or find the keys (Buttons 2 or 3)..and when if he clicked on Button2...give the keys' position(e.x. click on Button4) or if he clicked on Button3 print the keys position(e.x. Kitchen=Button4)

Is it applicable or I have to import(give me) the data in another way??

My main project is to help people who suffer from alzheimer disease.

My code is below (in my class):


if response=='Give':
  a[x]=y      # add to dictionary
elif response=='Search':
  for i in a:
      if i==x:

def keyss(self):
  global x
def kitchenn(self):
  global y
def klik_give(self):
  global response
def klik_search(self):
  global response

The problem is that python runs the buttons' commands before buttons clicked.So, x,y have already their values and "response" has the value of "Give" because the command is later in the code (I am not sure about this..)

Thanks in advance.

All times are GMT. The time now is 09:18 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.