Having problems using Tkinter

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Tue Jul 1 06:52:54 EDT 2008


On Tue, 01 Jul 2008 03:13:42 -0700, viv1tyagi wrote:

> Hi everyone ! ! !
> 
> I'm just a month old in the world of Python and trying to develop an
> application using Tkinter in which a new window pops out on a
> particular button press.The code for this new window is in
> "AddKlas.py" file.
> The  problem is  all the content of the new window is overwritten on
> the previous window.
> Below is the code of the two files

There can be only one `Tkinter.Tk` instance per running program.  Other
top level windows have to be `Tkinter.Toplevel` instances.

And you should reconsider your usage of classes.  You are just abusing
them as containers for functions without using `self` really.  And you
should pass the instance of the parent widget as first argument to
constructors of widgets.  Otherwise the very first, i.e. the `Tk` instance,
is assumed, which is not true for the widgets that should appear in the
`Toplevel` instance.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list