I'm now trying to respond to listbox changes and have two problems illustrated in the example below. The example's an extension of the one that Cameron Laird supplied in a response earlier today.
1) How do I make things happen in the main loop when they do in an instance of SListbox? SListbox.click() runs fine, but I just can't see how to call methods in main. I'd thought that self.master might hold the keys (maybe even literally), but I can't work that out. 2) Why can I not bind to arrow keys (Up in this example)? Arrow keys do not change the list box and, presumably as a consequence, I can't get the SListbox.uparrow() method to run. As ever, thank you for direction. Regards, Geoff -------------------------------------------------------- import Tkinter class SListbox(Tkinter.Frame): # Listbox in a frame, will be linked with other widgets def __init__(self, parent): Tkinter.Frame.__init__(self, parent) self.pack() self.list = Tkinter.Listbox(self) self.list.pack() self.list.bind('<ButtonRelease-1>', self.click) self.list.bind('<Up>', self.uparrow) def append(self, entry): self.list.insert(Tkinter.END, entry) def click(self, args=None) : # This method works, but I don't know how # to make it affect the main loop so that I can act on it print 'Clicked Selection', str(self.list.curselection()) # self.master.... what now? I want to populate the text box. def uparrow(self, args=None) : # This method is never reached print 'Uparrow' m = Tkinter.PanedWindow(orient = Tkinter.VERTICAL) m.pack(fill = Tkinter.BOTH, expand = 1) top = Tkinter.Label(m, text = "Do you see how wide the top pane is?") m.add(top) # New listbox in a frame list = SListbox(m) m.add(list) text = Tkinter.Text(m) m.add(text, height=20, width=10) bottom = Tkinter.Label(m, text = "bottom pane") m.add(bottom) m.winfo_toplevel().title("look at me") for entry in range(20): list.append("entry "+str(entry)) #Tkinter.mainloop() -------------------------------------------------------- -- View this message in context: http://www.nabble.com/Method-calling-upwards--Listbox-arrow-events---tp18318831p18318831.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss