Movatterモバイル変換


[0]ホーム

URL:


Tkinter Context Menus select their first item even if you don't want them to

Phlipphlip_cpp at my-deja.com
Fri Apr 13 02:16:28 EDT 2001


Proclaimed Phlip from the mountaintops:> Hyp Ton:>> Try this code... You can right-click on the canvas to make the menu> pop up.>>http://mail.python.org/pipermail/python-list/1999-November/015485.html>> However, if you make the first menu item call a command that calls> 'sys.exit(0)', merely summoning the menu with <Button-3> croaks the> program.>> Real Context Menus display and then await a further input. This means you> can back out of an action instead of comiting it. Platform is LinuxPpc.>> My current work-around is to make the first item do nothing, but I'd> obviously prefer a real fix.Thanks to someone for the request that I provide the offending source, but I'm on another project right now.I suspect the issue boils down to with my code the geometry math puts the menu such that the mouse is over the first item when the tip appears. Then mouse-up selects the item.The fix is to get the geometry right, putting the menu a pixel southwest of the mouse, and maybe to trigger the context menu on mouse-up instead of mouse-down.--   Phlipphlip_cpp at my-deja.com==============http://phlip.webjump.com ==============  --  I don't want to work. I want to surf on de 'net all day.      I don't want to play. I just want to surf on de 'net all day.  --


More information about the Python-listmailing list

[8]ページ先頭

©2009-2025 Movatter.jp