473,722 Members | 2,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tkinter listbox question

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 example):

import ftputil
import Tkinter
root=Tkinter.Tk ()
ftp=ftputil.FTP Host('some imaginary server')

def LabelWidget(eve nt):
a=Tkinter.Label (root,text=) # Text must be only name and file
format,example: sun.gif
a.grid()

b=Tkinter.Listb ox(root)
b.insert(Tkinte r.END,ftp._dir( ''))
b.place()
c=Tkinter.Butto n(root,text='PR INT THIS FILE IN NEW LABEL WIDGET')
c.bind('<Button-1>',LabelWidget )
c.grid()
root.mainloop()
THANKS!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!

Aug 31 '06 #1
3 2578

<ve************ @yahoo.comWrote :
| 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 example):
|
| import ftputil
| import Tkinter
| root=Tkinter.Tk ()
| ftp=ftputil.FTP Host('some imaginary server')
|
| def LabelWidget(eve nt):
| a=Tkinter.Label (root,text=) # Text must be only name and file
| format,example: sun.gif
| a.grid()
|
|
|
| b=Tkinter.Listb ox(root)
| b.insert(Tkinte r.END,ftp._dir( ''))
| b.place()
| c=Tkinter.Butto n(root,text='PR INT THIS FILE IN NEW LABEL WIDGET')
| c.bind('<Button-1>',LabelWidget )
| c.grid()
| root.mainloop()
|
|
| THANKS!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!
idx = b.curselection( ) # - tells you which one was clicked
StringValue = b.get(idx) # - returns the text

HTH - Hendrik

Sep 1 '06 #2
I am looking for an old friend, used to work at a path lab in Pretoria,
dabbled in Scientology and rock climbing? I know this is not
friendster.com, but I really have to get into contact with him.

Hendrik van Rooyen wrote:
<ve************ @yahoo.comWrote :
| 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 example):
|
| import ftputil
| import Tkinter
| root=Tkinter.Tk ()
| ftp=ftputil.FTP Host('some imaginary server')
|
| def LabelWidget(eve nt):
| a=Tkinter.Label (root,text=) # Text must be only name and file
| format,example: sun.gif
| a.grid()
|
|
|
| b=Tkinter.Listb ox(root)
| b.insert(Tkinte r.END,ftp._dir( ''))
| b.place()
| c=Tkinter.Butto n(root,text='PR INT THIS FILE IN NEW LABEL WIDGET')
| c.bind('<Button-1>',LabelWidget )
| c.grid()
| root.mainloop()
|
|
| THANKS!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!
idx = b.curselection( ) # - tells you which one was clicked
StringValue = b.get(idx) # - returns the text

HTH - Hendrik
Sep 1 '06 #3
Yes, and Du Buisson's and a variety of others. Liked spiders and spent
time at the WNNR?
lind wrote:
I am looking for an old friend, used to work at a path lab in Pretoria,
dabbled in Scientology and rock climbing? I know this is not
friendster.com, but I really have to get into contact with him.

Hendrik van Rooyen wrote:
<ve************ @yahoo.comWrote :
| 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 example):
|
| import ftputil
| import Tkinter
| root=Tkinter.Tk ()
| ftp=ftputil.FTP Host('some imaginary server')
|
| def LabelWidget(eve nt):
| a=Tkinter.Label (root,text=) # Text must be only name and file
| format,example: sun.gif
| a.grid()
|
|
|
| b=Tkinter.Listb ox(root)
| b.insert(Tkinte r.END,ftp._dir( ''))
| b.place()
| c=Tkinter.Butto n(root,text='PR INT THIS FILE IN NEW LABEL WIDGET')
| c.bind('<Button-1>',LabelWidget )
| c.grid()
| root.mainloop()
|
|
| THANKS!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!
idx = b.curselection( ) # - tells you which one was clicked
StringValue = b.get(idx) # - returns the text

HTH - Hendrik
Sep 1 '06 #4

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

Similar topics

2
5826
by: Jørgen Hansen | last post by:
Hi I have a problem with a Listbox in Tkinter. When I tab through several widgets with the tab-key, the listbox looses its selection, even though it has been selected with .selection_set. The example below demonstrates this. Can anyone provide me with some help on this? Regards Jorgen
4
5320
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 program wants to write a new entry. This works OK, except that sometimes we want to copy out of piece of the contents and paste it in another window. When it's DISABLED, it appears that we can't even select a portion of the text. Is this an...
0
1312
by: Bryan Olson | last post by:
I've run into a problem with Python/TkInter crashing, with an attempt to read illegal addresses, on Win on Win2000 and WinXP. With some web-searching, I found that people say not to manipulate TkInter from multiple threads, except that the call event_generate() is safe. I assume the call adds an event to Tk's queue, and later the thread running mainloop will() pick up the event. I tried to write a general-purpose thread-runner. In...
2
5133
by: Zhang Le | last post by:
Hello, Is there a quick way to replace the content of a single item in tkinter's listbox? Currently my solution is to first delete the item, then insert a new item at the same position. I think there may be better way. Zhang Le
1
2776
by: Ebba Cecilia Ovesdotter Alm | last post by:
Hello, I'm learning how to use the Tkinter module. I would like to use an element similar to a drop-down form, where the user can select one option out of many. I thought that a Listbox item could do just this. The following extract from my code (with the listbox part basically mirroring http://effbot.org/books/tkinterbook/listbox.htm), does, however, not create a visable Listbox. Am I interpreting the Listbox incorrectly? Ideas or...
2
11537
by: Harlin Seritt | last post by:
Whenever I set up something similar: vals = for v in vals: listbox.inset(END, v) I notice that when this listbox is displayed, there is never a default value. How can I make sure that one of the indices is selected by default?
3
6693
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 re-create common methods and make sure they're mapped to the right component (inside this widget are frame, entry, listbox, and scrollbar widgets). I tried to look for ways I could inherit some methods from other widgets but couldn't think of how to do...
3
1325
by: groves | last post by:
hi eveyrbody , i have started working on python tkinter, While I was working on one of the tkinter classes..named listbox widget. I had a slight problem. Now let me tell you that i was able to create a simple listbox which had 6 options which one can select, but Now what I want is that from the available menu, if I select an option it should give me another menu associated with that option. Its like digging up that option to do advance...
32
7481
by: Kevin Walzer | last post by:
I'm a Tcl/Tk developer who has been working, slowly, at learning Python, in part because Python has better support for certain kinds of applications that I want to develop than Tcl/Tk does. Naturally, I thought that I would use Tkinter as the GUI for these programs. However, in doing research into GUI development techniques, sample code, and showcase applications, what has struck me is how little sophisticated GUI development seems to be...
0
8867
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8740
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9386
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9158
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9090
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8059
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6685
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4503
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.