[Tkinter-discuss] divergent behaviour

Alan Gauld alan.gauld at btinternet.com
Mon Jun 23 12:15:43 CEST 2014


On 23/06/14 10:00, Michael Lange wrote:

> is it possible to post only the evEdit() function? Without that I can only
> guess, maybe the use of event.widget there causes confusion? Is the
> parent window the Tk() window or another Toplevel()?

The parent is the main Tk window.
The evEdit doesn't use the event in any way.

Here are the construction lines and the event function...

class TerritoryWindow(tk.Frame):
     def __init__(self, parent):
        tk.Frame.__init__(self,parent)
...

        self.eventlist = tk.Listbox(self.history,
                                    width=45, font=('mono','10', ''))
        self.eventlist.bind('<ButtonRelease-1>', self.eventSelect)
        self.eventlist.bind('<Double-1>',self.doEdit)
...
        self.editEvent = tk.Button(self.eventbuttons, text="Edit",
                                   command=self.doEdit)


     def doEdit(self, ev=None):
        event = self.eventlist.get(self.eventlist.curselection()).split()
        me = MapEntry(self, event)
        data.updateEvent((self.eventID,) + me.result)
        self.showEvents()


MapEntry is the editing dialog box.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tkinter-discuss mailing list