473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Tkinter listbox:get

Hi,
I need help about Tkinter.I want,when somebody click on some item in
listbox,then
in new entry widget must write that item

Regards,
Vedran

Sep 7 '06 #1
2 4045
<ve************@yahoo.comWrote:
| Hi,
| I need help about Tkinter.I want,when somebody click on some item in
| listbox,then
| in new entry widget must write that item
|
| Regards,
| Vedran

I have already covered the retrieval from the listbox in another thread.
You can set the entry box contents like this:

NameOfStringForEntryboxContents = StringVar()

Then in your definition of the Entry box, add in:

textvariable = NameOfStringForEntryboxContents

and when you have retreived the listbox entry:

NameOfStringForEntryboxContents.set(NameOfStringWi thListboxStuff)

and it will appear in your entry field...

HTH
-Hendrik

Sep 8 '06 #2
<ve************@yahoo.comwrote 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

Sep 9 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Patrick L. Nolan | last post by:
Our Tkinter application has a big ScrolledText widget which is a log of everything that happens. In order to prevent people from making changes, we have it in DISABLED mode except when the...
3
by: Harlin Seritt | last post by:
I've created a ghetto-ized ComboBox that should work nicely for Tkinter (unfortunately no dropdown capabilities yet). I've found why it's such a pain in the @ss to create one. You have to...
2
by: collie | last post by:
Hi, I have 2 listboxes. The first gets populated from the db as soon as the page loads. The second listbox get populated based on the user's selection from the first listbox. However,...
1
by: VB novice | last post by:
This should be too simple. I want to click on an item populated in a ListBox and have that item appear in a textbox.text field. I can not get the item to appear. The items in the ListBox get...
3
by: vedran_dekovic | last post by:
Hi, I need help about Tkinter listbox widget.I want,when somebody click on any item(file) in Listbox,then in new Label widget text must be selected item from server. my program (wrong...
0
by: Svenn Bjerkem | last post by:
Hi, Armed with Programming Python 3rd Edition and Learning Python 2nd edition I try to write an application which I at first thought was simple, at least until I was finished with the GUI and...
5
by: crystalattice | last post by:
I'm creating a shelve interface using Tkinter. I have a button that allows the user to modify an existing entry; when the button is clicked, a new TopLevel window appears with Entry boxes holding...
1
PareshRathod
by: PareshRathod | last post by:
Hello All, I am facing problem : When my page get postback, items added manually to listbox get cleared... This postback happened when i click calendar. Thing which i want to do is to, "My...
4
by: rahulnag22 | last post by:
Hi, If I have a button widget w = Button(root, text = "Button", state = 'disabled') How can I get the value of option 'state' from the widget 'w'. I want something like -- print w.state ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.