Tkinter Menu tearoff

John Grayson johngrayson at home.com
Tue Sep 12 15:12:17 EDT 2000


In article <75F7304BB41CD411B06600A0C98414FCB368E8 at ORSMSX54>,
  "Daley, Mark W" <mark.w.daley at intel.com> wrote:
> I am having difficulty removing the tearoff from my menus.  I am using
Tk
> 8.0.5.  Here is the code and message.
>
> def makefilemenu():
> 	filebtn = Menubutton(mbar, text = 'File', tearoff = 0)
> 	filebtn.pack(side=LEFT)
> 	filebtn.menu = Menu(filebtn)
>
> 	filebtn.menu.add_command(label = 'Quit', command = die)
>
> 	filebtn['menu'] = filebtn.menu
> 	return filebtn
>
> Traceback (innermost last):
>   File "<pyshell#0>", line 1, in ?
>     import cit
>   File "C:\Python\cit.py", line 128, in ?
>     filebtn = makefilemenu()
>   File "C:\Python\cit.py", line 104, in makefilemenu
>     filebtn = Menubutton(mbar, text = 'File', tearoff = 0)
>   File "C:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 1571, in
> __init__
>     Widget.__init__(self, master, 'menubutton', cnf, kw)
>   File "C:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 1084, in
> __init__
>     self.tk.call(
> TclError: unknown option "-tearoff"
>
>

tearoff is a Menu attribute... The menu is the container for
MenuButtons, Cascades etc. and it is the container that gets
the tearoff.


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list