[Tkinter-discuss] divergent behaviour(complete code)
Alan Gauld
alan.gauld at btinternet.com
Tue Jun 24 19:45:00 CEST 2014
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
More information about the Tkinter-discuss
mailing list