On 17/10/17 20:13, Peter Otten wrote:
#!/usr/bin/python3
#test listbox
from tkinter import *
class Dialog(Frame):
def __init__(self, master):
Frame.__init__(self, master)
self.list = Listbox(self, selectmode=EXTENDED)
self.list.pack(fill=BOTH, expand=1)
self.current = None
self.poll() # start polling the list
def poll(self):
now = self.list.curselection()
if now != self.current:
self.list_has_changed(now)
self.current = now
self.after(250, self.poll)
def list_has_changed(self, selection):
print ("selection is", selection)
snames=('fred', 'george', 'manuel', 'john', 'eric', 'terry')
master = Tk()
dialog = Dialog(master)
dialog.pack()
for item in snames:
dialog.list.insert(END, item)
mainloop()
Thank you, that works, I have difficulties with object oriented coding.
Never used a language where I needed it.
Regards, Chris Roy-Smith
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor