On 22/06/14 23:18, Alan Gauld wrote:

Does anyone know why double-click and button versions
of the same method result in different locations? I'm
assuming that somehow the dialog (TopLevel widget) sees
the screen as its parent in one version but the
original window as parent in the other - maybe...?

Here is a complete example that shows the same behaviour...

import Tix as tk
#this uses a local copy of Fred Lundh's Dialog class from his web site
# not the standard library version which is very similar...

import tkDialog

class MainWin(tk.Frame):
   def __init__(self,parent):
      tk.Frame.__init__(self,parent)
      L = tk.Label(self,text='double click me')
      L.pack()
      L.bind('<Double-1>',self.show)
      tk.Button(self,width=30,text='push me', command=self.show).pack()
      self.pack()

   def show(self,ev=None):
      testD(self)

class testD(tkDialog.Dialog):
   def body(self,parent):
       tk.Label(self,text="How'd I do?").pack()

top = tk.Tk()
app = MainWin(top)
top.mainloop()



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

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to