[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: Tkinter listbox:get
From:       "Hendrik van Rooyen" <mail () microcorp ! co ! za>
Date:       2006-09-09 8:41:19
Message-ID: 020201c6d3eb$db1fafa0$03000080 () hendrik
[Download RAW message or body]

 <vedran_dekovic@yahoo.com> wrote in email:


| Hi,and sorry I forget tell you what I want exactly.
|
| My problem is
|
| example:
|
| when I write like you tell me:
|
| >>> idx=lb.curselection()
| >>> StringValue=lb.get(idx)   <======= This


|
| ....THEN,ERROR IS:
|
| Traceback (most recent call last):
|   File "<pyshell#18>", line 1, in -toplevel-
|     StringValue=b.get(idx)       <========== is not the same as this



|   File "C:\Python24\lib\lib-tk\Tkinter.py", line 2432, in get
|     return self.tk.call(self._w, 'get', first)
| TclError: bad listbox index "": must be active, anchor, end, @x,y, or a
| number
|
| ...which index I must write to listbox get just clicked row.
|
|
| THANKS!!!!!!!!
|

Just use the print statement to see what is going on - use :

print idx

after getting the idx with the curselection - it must be the number of the row
that
was clicked

- Hendrik



-- 
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic