pop up menu down

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

pop up menu down

monuindia@gmail.com
Hi,
I have a pop up menu used to pop at right click, but the problem is it doesn't go away until I click on one of it's button. I want it to be disappeared or destroyed when I click anywhere else. Can anyone tell me what I am missing?

_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss
Reply | Threaded
Open this post in threaded view
|

Re: pop up menu down

midtoad
this might not be what you want, but you could include a menu-item  
"Close Menu" in your pop-up menu, which would destroy (close) the pop-
up menu...

S



On Sep 19, 2005, at 22:41, Monu Agrawal wrote:

> Hi,
> I have a pop up menu used to pop at right click, but the problem is  
> it doesn't go away until I click on one of it's button. I want it  
> to be disappeared or destroyed when I click anywhere else. Can  
> anyone tell me what I am missing?
> _______________________________________________
> Tkinter-discuss mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>

_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss
Reply | Threaded
Open this post in threaded view
|

Re: pop up menu down

Martin Franklin
Stewart Midwinter wrote:

> this might not be what you want, but you could include a menu-item  
> "Close Menu" in your pop-up menu, which would destroy (close) the pop-
> up menu...
>
> S
>
>
>
> On Sep 19, 2005, at 22:41, Monu Agrawal wrote:
>
>
>>Hi,
>>I have a pop up menu used to pop at right click, but the problem is  
>>it doesn't go away until I click on one of it's button. I want it  
>>to be disappeared or destroyed when I click anywhere else. Can  
>>anyone tell me what I am missing?
>>_______________________________________________
>>Tkinter-discuss mailing list
>>[hidden email]
>>http://mail.python.org/mailman/listinfo/tkinter-discuss
>>


Strange on my box (fedora core 4) is doesn't stay poped up so if I
release mouse button 3 it disappears.  Perhaps it is a platorm issue?
my popup code is below:-


class PopupMenu:
     def __init__(self, parent):
         self.parent = parent
         self.menu=Menu(None,tearoff=0)

     def __call__(self, event):
         self.menu.tk_popup(event.x_root ,event.y_root)

     def add_separator(self):
         self.menu.add_separator()

     def add(self, text, command):
         self.menu.add_command(label=text, command=command)
     add_command = add




and when I use it :-


         fileMenu = PopupMenu(self)
         fileMenu.add_command("Create New File", command=self.createFile)
         self.fileList.body_bind("<3>", fileMenu)


HTH
Martin








_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss