[Tkinter-discuss] divergent behaviour
Michael Lange
klappnase at web.de
Tue Jun 24 17:34:56 CEST 2014
On Tue, 24 Jun 2014 00:51:51 +0100
Alan Gauld <alan.gauld at btinternet.com> wrote:
> On 24/06/14 00:27, Alan Gauld wrote:
(...)
> > I don't, I just leave Tk to do its thing. Its a subclass of Fred's
> > standard Dialog class with the body and apply methods overridden to
> > populate the form with the original data and return the values
>
> Here it is in its entirety.
>
> class MapEntry(Dialog):
> def __init__(self, parent, data):
> self.data = data
> Dialog.__init__(self, parent, title="History Editor")
>
> def body(self, parent):
> tk.Label(parent,
> text="Map: %s" % self.data[0]).grid(row=0, sticky="W")
> tk.Label(parent, text="Publisher: ").grid(row=1, sticky="W")
> self.ePub = tk.Entry(parent)
> self.ePub.insert(tk.END, self.data[1].strip() + ' '
> +self.data[2].strip()) # initial & name
> self.ePub.grid(row=1, column=1)
> tk.Label(parent, text="Date Out: ").grid(row=2, sticky="W")
> self.eDO = tk.Entry(parent)
> self.eDO.insert(tk.END, self.data[3].strip())
> self.eDO.grid(row=2, column=1)
> tk.Label(parent, text="Date In: ").grid(row=3, sticky="W")
> self.eDI = tk.Entry(parent)
> self.eDI.insert(tk.END, self.data[4].strip())
> self.eDI.grid(row=3, column=1)
> return self.ePub
>
> def apply(self):
> self.result = (self.data[0],self.ePub.get(),
> self.eDO.get(),self.eDI.get())
>
> One thing to add is that I'm using tix, not standard Tk widgets,
> but I don't think that should affect anything...
Hmm, so the dialog toplevel window is a child of the Frame... I don't
think that this should be a problem, but maybe you could try to make it a
child of the Tk window?
.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
First study the enemy. Seek weakness.
-- Romulan Commander, "Balance of Terror", stardate 1709.2
More information about the Tkinter-discuss
mailing list