Tkinter, Alt, and Windows

Discussion in 'Python' started by Tim Daneliuk, Jan 7, 2005.

  1. Tim Daneliuk

    Tim Daneliuk Guest

    Arrrrrggg. I have a program that runs comfortably across both Unix variants
    and Windows ... except .... I wish to bind an Alt-ButtonRelease-3 combination
    to popup a menu. This works flawlessly under Unix, but with windows,
    the menu appears briefly and then disappears. I'm guessing that Alt
    under windows generates another event that I am not catching and the
    default internal Tk message handler is processing it and causing my
    menu to get destroyed.

    It seems that any combination involving the Alt key has this issue -
    for example Control-Alt-ButtonRelease-3 does the same thing.

    Has anyone else run into this behavior and have a fix???

    TIA,
    ----------------------------------------------------------------------------
    Tim Daneliuk
    PGP Key: http://www.tundraware.com/PGP/
     
    Tim Daneliuk, Jan 7, 2005
    #1
    1. Advertising

  2. Tim Daneliuk

    Tim Daneliuk Guest

    Tim Daneliuk wrote:

    > Arrrrrggg. I have a program that runs comfortably across both Unix
    > variants
    > and Windows ... except .... I wish to bind an Alt-ButtonRelease-3
    > combination
    > to popup a menu. This works flawlessly under Unix, but with windows,
    > the menu appears briefly and then disappears. I'm guessing that Alt
    > under windows generates another event that I am not catching and the
    > default internal Tk message handler is processing it and causing my
    > menu to get destroyed.
    >
    > It seems that any combination involving the Alt key has this issue -
    > for example Control-Alt-ButtonRelease-3 does the same thing.
    >
    > Has anyone else run into this behavior and have a fix???
    >


    I have a partial workaround but the mechanics still mystify me.
    I actually was trying to bind two different popup menus to as follows:

    Alt-ButtonRelease-3 Menu1
    Alt-Control-ButtonRelease-3 Menu2

    This did not work ... so I began to wonder if this was problem
    with Tk using greedy matching with event descriptors. So, I changed
    it as follows:

    Control-ButtonRelease-3 Menu1
    Alt-Control-ButtonRelease-3 Menu2

    This now works fine, BUT ONLY if Alt is pressed *before* Control when popping up
    Menu2. IOW Windows is sensitive to the *order* of Alt being applied where
    Unix is not. Very, very strange ...




    --
    ----------------------------------------------------------------------------
    Tim Daneliuk
    PGP Key: http://www.tundraware.com/PGP/
     
    Tim Daneliuk, Jan 7, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sastwhc
    Replies:
    0
    Views:
    414
    sastwhc
    Dec 6, 2005
  2. ub
    Replies:
    13
    Views:
    564
  3. Hidekazu IWAKI
    Replies:
    1
    Views:
    416
    Peter Otten
    Dec 14, 2009
  4. Hidekazu IWAKI
    Replies:
    0
    Views:
    551
    Hidekazu IWAKI
    Dec 15, 2009
  5. Den
    Replies:
    15
    Views:
    908
    Nobody
    Sep 3, 2011
Loading...

Share This Page