tkinter menu (newbie question)
eric.brunel at pragmadev.com
Wed Jun 19 20:34:40 CEST 2002
Stephane Ninin wrote:
> Eric Brunel <eric.brunel at pragmadev.com> a tapote dans
> news:aeq0cv$p5g$1 at wanadoo.fr:
>>> If I want to use several of these windows,
>>> can still use for base class Tk, instead of Frame ?
>> Nope: the instance of Tk is your main window. There should only be
>> one, and closing it will end your application. If you want to create
>> other windows, you should create instances of Toplevel.
> So, what would be the easiest way to attach a menu to a window which is
> not the main window ? (that is which doesnot inherit from Tk class)
> It seems that Frame class has no menu key,
> so I cannot use config(menu=...)
> for a class that would inherit for Frame...
Do not inherit from Frame. A frame is not a window: it's just an
all-purpose container. Creating a frame (or an instance of a sub-class of
frame) will create it in the main window (your instance of Tk). If you want
to create your own classes for windows, create sub-classes of Toplevel.
- Eric Brunel <eric.brunel at pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
More information about the Python-list