I figured out a sort of work around. As far as I can tell, the Control, Shift, and Alt keys all work they way I'd like my other keys to work (only one KeyPress/KeyRelease). I used that to do this:
$top->bind('<Control-KP_Left>' => sub{ &pressed("left",1,2) }); $top->bind('<Control-KP_Down>' => sub{ &pressed("back",0, 7) }); $top->bind('<Control-KP_Right>' => sub{ &pressed("right",5, 6) }); $top->bind('<Control-KP_Home>' => sub{ &pressed("spinl",1, 3, 5, 7) } +); $top->bind('<Control-KP_Up>' => sub{ &pressed("forward",3, 4) }); $top->bind('<Control-KP_Prior>' => sub{ &pressed("spinr",0, 2, 4, 6) } +); sub pressed { my @args = @_; my $arg = shift @args; &fire_thrusters(@args); for ($arg){ /left/i && do { $top->bind('<Control-KP_Left>' => sub{}); }; /right/i && do { $top->bind('<Control-KP_Right>' => sub{}); }; /back/i && do { $top->bind('<Control-KP_Down>' => sub{}); }; /forward/i && do { $top->bind('<Control-KP_Up>' => sub{}); }; /spinl/i && do { $top->bind('<Control-KP_Home>' => sub{}); }; /spinr/i && do { $top->bind('<Control-KP_Prior>' => sub{}); }; } $top->bind('<KeyRelease-Control_R>' => sub{ &released($arg) }); $top->bind('<KeyRelease-Control_L>' => sub{ &released($arg) }); } sub released { my $arg = shift; &stop; for ($arg){ /left/i && do { $top->bind('<Control-KP_Left>' => sub{ &presse +d("left",1,2) }); }; /right/i && do { $top->bind('<Control-KP_Right>' => sub{ &presse +d("right",5, 6) }); }; /back/i && do { $top->bind('<Control-KP_Down>' => sub{ &presse +d("back",0, 7) }); }; /forward/i && do { $top->bind('<Control-KP_Up>' => sub{ &presse +d("forward",3, 4) }); }; /spinl/i && do { $top->bind('<Control-KP_Home>' => sub{ &presse +d("spinl",1, 3, 5, 7) }); }; /spinr/i && do { $top->bind('<Control-KP_Prior>' => sub{ &presse +d("spinr",0, 2, 4, 6) }); }; } $top->bind('<KeyRelease-Control_R>' => sub{}); $top->bind('<KeyRelease-Control_L>' => sub{}); }
Now the user can press Ctrl-8 and hold Ctrl until they want to call the &released function. It's not nearly as cool as just holding down the Numpad keys, but I guess it'll work. If someone has a better solution please post.

In reply to Re: Tk bind KeyPress KeyRelease Problem by Anonymous Monk
in thread Tk bind KeyPress KeyRelease Problem by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.