You can manually create a tearoff from a menu:
% .m clone .mt tearoff
and post it at a desired location:
% .mt post 100 100
As suggested in the other message, you can use "wm resizeable" to make
it not change size:
% wm resiz .mt 0 0
(Of course, I only tested this on linux, so on Windows YMMV)
Unfortunately, the menu 'clone' subcommand does not seem to be wrapped
in Python. You can add it, but it'll be gross and touches stuff that
should be considered implementation details of Tkinter (works with
all python2.x I'm aware of, though):
# ----------------------------------------------------------------------
import Tkinter, types
def makewidget(master, klass, path):
path = str(path)
self = types.InstanceType(klass)
self._name = path[len(master._w)+1:]
self._w = path
self.children = {}
master.children[self._name] = self
self.master = master
self.tk = master.tk
return self
def tearoff(menu):
child = str(menu) + ".tearoff"
menu.tk.call((menu, "clone", child, "tearoff"))
return makewidget(menu, Tkinter.Menu, child)
# ----------------------------------------------------------------------
And then you'll find that 'wm_resizable' is not available because Menu
is not a subclass of Wm. Just call it directly through Tk:
>>> mt = tearoff(m)
>>> mt.tk.call("wm", "resizable", mt, 0, 0)
>>> mt.post(100, 100)
Jeff
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss