IDLE Extension: CallTips

Mark Hammond MHammond at skippinet.com.au
Thu Jun 3 09:04:28 CEST 1999


Guido suggested a few changes to CallTips.py as posted, making it work very
nicely.  I attach a version with the following changes:

* Cancelling of the Call Tips is now robust, due to knowing the magic events
to hook.

* Turns out my code was Windows specific (surprise :-)  Seems Tkinter on
windows recongises "Key-(" but Unix does not.  Changed to "<Key-parenleft>",
and it works fine on Unix (so Im told <wink>)

* Comments updated, and code cleaned slightly.

This has now been checked into the Python CVS tree - if you are interested,
please follow further updates there.

Enjoy!

Mark.



begin 666 CallTips.py
M(R!#86QL5&EP<RYP>2 M($%N($E$3$4 at 97AT96YS:6]N('1H870@<')O=FED
M97,@(D-A;&P at 5&EP<R(@+2!I92P at 82!F;&]A=&EN9R!W:6YD;W<@=&AA= T*
M(R!D:7-P;&%Y<R!P87)A;65T97(@:6YF;W)M871I;VX at 87,@>6]U(&]P96X@
M<&%R96YS+ at T*#0II;7!O<G0@<W1R:6YG#0II;7!O<G0@<WES#0II;7!O<G0@
M='EP97,-"@T*8VQA<W, at 0V%L;%1I<',Z#0H-"B @("!M96YU9&5F<R ](%L-
M"B @("!=#0H-"B @("!K97ED969S(#T@>PT*(" @(" @(" G/#QP87)E;BUO
M<&5N/CXG.B!;)SQ+97DM<&%R96YL969T/B==+ T*(" @(" @(" G/#QP87)E
M;BUC;&]S93X^)SH at 6R<\2V5Y+7!A<F5N<FEG:'0^)UTL#0H@(" @(" @("<\
M/&-H96-K+6-A;&QT:7 M8V%N8V5L/CXG.B!;)SQ+97E296QE87-E/B==+ T*
M(" @(" @(" G/#QC86QL=&EP+6-A;F-E;#X^)SH at 6R<\0G5T=&]N4')E<W,^
M)RP@)SQ+97DM17-C87!E/B==+ T*(" @('T-"@T*(" @('=I;F1O=W-?:V5Y
M9&5F<R ]('L-"B @("!]#0H-"B @("!U;FEX7VME>61E9G,@/2![#0H@(" @
M?0T*#0H@(" @9&5F(%]?:6YI=%]?*'-E;&8L(&5D:71W:6XI. at T*(" @(" @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
M8FIE8W1?871?8W5R<V]R*"DI#0H@(" @(" @(&EF(&%R9U]T97AT. at T*(" @
M(" @(" @(" @<V5L9BYC86QL=&EP7W-T87)T(#T@<V5L9BYT97AT+FEN9&5X
M*")I;G-E<G0B*0T*(" @(" @(" @(" @<V5L9BYC86QL=&EP(#T@<V5L9BY?
M;6%K95]C86QL=&EP7W=I;F1O=R at I#0H@(" @(" @(" @("!S96QF+F-A;&QT
M:7 N<VAO=W1I<"AA<F=?=&5X="D-"B @(" @(" @<F5T=7)N("(B("-S;R!T
M:&4 at 979E;G0@:7,@:&%N9&QE9"!N;W)M86QL>2X-"@T*(" @(&1E9B!P87)E
M;E]C;&]S95]E=F5N="AS96QF+"!E=F5N="DZ#0H@(" @(" @(", at 3F]W(&IU
M<W0@:&ED97,L(&)U="!L871E<B!W92!S:&]U;&0 at 8VAE8VL@:68@;W1H97(-
M"B @(" @(" @(R!P87)E;B=D(&5X<')E<W-I;VYS(')E;6%I;B!O<&5N+ at T*
M(" @(" @("!S96QF+E]R96UO=F5?8V%L;'1I<%]W:6YD;W<H*0T*(" @(" @
M("!R971U<FX@(B(@(W-O('1H92!E=F5N="!I<R!H86YD;&5D(&YO<FUA;&QY
M+ at T*#0H@(" @9&5F(&-H96-K7V-A;&QT:7!?8V%N8V5L7V5V96YT*'-E;&8L
M(&5V96YT*3H-"B @(" @(" @:68@<V5L9BYC86QL=&EP. at T*(" @(" @(" @
M(" @(R!)9B!W92!H879E(&UO=F5D(&)E9F]R92!T:&4@<W1A<G0@;V8@=&AE
M(&-A;&QT:7 L#0H@(" @(" @(" @(" C(&]R(&]F9B!T:&4 at 8V%L;'1I<"!L
M:6YE+"!T:&5N(&-A;F-E;"!T:&4@=&EP+ at T*(" @(" @(" @(" @(R H3&%T
M97(@;F5E9"!T;R!B92!S;6%R=&5R(&%B;W5T(&UU;'1I+6QI;F4L(&5T8RD-
M"B @(" @(" @(" @(&EF('-E;&8N=&5X="YC;VUP87)E*")I;G-E<G0B+" B
M/#TB+"!S96QF+F-A;&QT:7!?<W1A<G0I(&]R(%P-"B @(" @(" @(" @(" @
M('-E;&8N=&5X="YC;VUP87)E*")I;G-E<G0B+" B/B(L('-E;&8N8V%L;'1I
M<%]S=&%R=" K("(@;&EN965N9"(I. at T*(" @(" @(" @(" @(" @('-E;&8N
M7W)E;6]V95]C86QL=&EP7W=I;F1O=R at I#0H@(" @(" @(')E='5R;B B(B C
M<V\@=&AE(&5V96YT(&ES(&AA;F1L960@;F]R;6%L;'DN#0H-"B @("!D968@
M8V%L;'1I<%]C86YC96Q?979E;G0H<V5L9BP at 979E;G0I. at T*(" @(" @("!S
M96QF+E]R96UO=F5?8V%L;'1I<%]W:6YD;W<H*0T*(" @(" @("!R971U<FX@
M(B(@(W-O('1H92!E=F5N="!I<R!H86YD;&5D(&YO<FUA;&QY+ at T*#0H@(" @
M9&5F(&=E=%]O8FIE8W1?871?8W5R<V]R*'-E;&8L#0H@(" @(" @(" @(" @
M(" @(" @(" @(" @(" @('=O<F1C:&%R<STB+E\B("L@<W1R:6YG+G5P<&5R
M8V%S92 K('-T<FEN9RYL;W=E<F-A<V4@*R!S=')I;F<N9&EG:71S*3H-"B @
M(" @(" @(R!86%@@+2!4:&ES(&YE961S('1O(&)E(&UO=F5D('1O(&$@8F5T
M=&5R('!L86-E#0H@(" @(" @(",@<V\@=&AE("(N(B!A='1R:6)U=&4@;&]O
M:W5P(&-O9&4 at 8V%N(&%L<V\@=7-E(&ET+ at T*(" @(" @("!T97AT(#T@<V5L
M9BYT97AT#0H@(" @(" @(&-H87)S(#T@=&5X="YG970H(FEN<V5R="!L:6YE
M<W1A<G0B+" B:6YS97)T(BD-"B @(" @(" @:2 ](&QE;BAC:&%R<RD-"B @
M(" @(" @=VAI;&4@:2!A;F0 at 8VAA<G-;:2TQ72!I;B!W;W)D8VAA<G,Z#0H@
M(" @(" @(" @("!I(#T@:2TQ#0H@(" @(" @('=O<F0@/2!C:&%R<UMI.ET-
M"B @(" @(" @:68@=V]R9#H-"B @(" @(" @(" @(", at 2&]W(&ES('1H:7,@
M9F]R(&$@:&%C:R$-"B @(" @(" @(" @(&EM<&]R="!S>7,L(%]?;6%I;E]?
M#0H@(" @(" @(" @("!N86UE<W!A8V4@/2!S>7,N;6]D=6QE<RYC;W!Y*"D-
M"B @(" @(" @(" @(&YA;65S<&%C92YU<&1A=&4H7U]M86EN7U\N7U]D:6-T
M7U\I#0H@(" @(" @(" @("!T<GDZ#0H@(" @(" @(" @(" @(" @(" @(')E
M='5R;B!E=F%L*'=O<F0L(&YA;65S<&%C92D-"B @(" @(" @(" @(&5X8V5P
M=#H-"B @(" @(" @(" @(" @(" @(" @<&%S<PT*(" @(" @("!R971U<FX@
M3F]N92 C($-A;B=T(&9I;F0 at 86X@;V)J96-T+ at T*#0ID968 at 9V5T7V%R9U]T
M97AT*&]B*3H-"B @(" C($=E="!A('-T<FEN9R!D97-C<FEB:6YG('1H92!A
M<F=U;65N=', at 9F]R('1H92!G:79E;B!O8FIE8W0N#0H@(" @87)G5&5X=" ]
M("(B#0H@(" @:68@;V(@:7,@;F]T($YO;F4Z#0H@(" @(" @(&%R9T]F9G-E
M=" ](# -"B @(" @(" @(R!B:70@;V8 at 82!H86-K(&9O<B!M971H;V1S("T@
M='5R;B!I="!I;G1O(&$@9G5N8W1I;VX-"B @(" @(" @(R!B=70@=V4 at 9')O
M<"!T:&4@(G-E;&8B('!A<F%M+ at T*(" @(" @("!I9B!T>7!E*&]B*3T]='EP
M97,N365T:&]D5'EP93H-"B @(" @(" @(" @(&]B(#T@;V(N:6U?9G5N8PT*
M(" @(" @(" @(" @87)G3V9F<V5T(#T@,0T*(" @(" @(" C(%1R>2!A;F0@
M8G5I;&0@;VYE(&9O<B!0>71H;VX at 9&5F:6YE9"!F=6YC=&EO;G,-"B @(" @
M(" @:68@='EP92AO8BD@:6X at 6W1Y<&5S+D9U;F-T:6]N5'EP92P@='EP97,N
M3&%M8F1A5'EP95TZ#0H@(" @(" @(" @("!T<GDZ#0H@(" @(" @(" @(" @
M(" @<F5A;$%R9W,@/2!O8BYF=6YC7V-O9&4N8V]?=F%R;F%M97-;87)G3V9F
M<V5T.F]B+F9U;F-?8V]D92YC;U]A<F=C;W5N=%T-"B @(" @(" @(" @(" @
M("!D969A=6QT<R ](&]B+F9U;F-?9&5F875L=',@;W(@6UT-"B @(" @(" @
M(" @(" @("!D969A=6QT<R ](&QI<W0H;6%P*&QA;6)D82!N86UE.B B/25S
M(B E(&YA;64L(&1E9F%U;'1S*2D-"B @(" @(" @(" @(" @("!D969A=6QT
M<R ](%LB(ET@*B H;&5N*')E86Q!<F=S*2UL96XH9&5F875L=',I*2 K(&1E
M9F%U;'1S#0H@(" @(" @(" @(" @(" @:71E;7,@/2!M87 H;&%M8F1A(&%R
M9RP at 9&9L=#H at 87)G*V1F;'0L(')E86Q!<F=S+"!D969A=6QT<RD-"B @(" @
M(" @(" @(" @("!I9B!L96XH<F5A;$%R9W,I*V%R9T]F9G-E=" \("AL96XH
M;V(N9G5N8U]C;V1E+F-O7W9A<FYA;65S*2 M(&QE;BAO8BYF=6YC7V-O9&4N
M8V]?;F%M97,I("DZ#0H@(" @(" @(" @(" @(" @(" @(&ET96US+F%P<&5N
M9"@B+BXN(BD-"B @(" @(" @(" @(" @("!A<F=497AT(#T@<W1R:6YG+FIO
M:6XH:71E;7, at +" B+" B*0T*(" @(" @(" @(" @(" @(&%R9U1E>'0@/2 B
M*"5S*2(@)2!A<F=497AT#0H@(" @(" @(" @("!E>&-E<'0Z#0H@(" @(" @
M(" @(" @(" @<&%S<PT*(" @(" @(" C(%-E92!I9B!W92!C86X@=7-E('1H
M92!D;V-S=')I;F<-"B @(" @(" @:68@:&%S871T<BAO8BP@(E]?9&]C7U\B
M*2!A;F0@;V(N7U]D;V-?7SH-"B @(" @(" @(" @('!O<R ]('-T<FEN9RYF
M:6YD*&]B+E]?9&]C7U\L(")<;B(I#0H@(" @(" @(" @("!I9B!P;W,\,"!O
M<B!P;W,^-S Z('!O<STW, T*(" @(" @(" @(" @:68 at 87)G5&5X=#H at 87)G
M5&5X=" ](&%R9U1E>'0@*R B7&XB#0H@(" @(" @(" @("!A<F=497AT(#T@
M87)G5&5X=" K(&]B+E]?9&]C7U];.G!O<UT-"@T*(" @(')E='5R;B!A<F=4
M97AT#0H-"B,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C
M(R,C(R,C(R,C(R,-"B,-"B, at 5&5S="!C;V1E#0HC#0II9B!?7VYA;65?7ST]
M)U]?;6%I;E]?)SH-"@T*(" @(&1E9B!T,2 at I.B B*"DB#0H@(" @9&5F('0R
M*&$L(&(]3F]N92DZ("(H82P at 8CU.;VYE*2(-"B @("!D968@=#,H82P@*F%R
M9W,I.B B*&$L("XN+BDB#0H@(" @9&5F('0T*"IA<F=S*3H@(B at N+BXI(@T*
M(" @(&1E9B!T-2AA+" J87)G<RDZ("(H82P at +BXN*2(-"B @("!D968@=#8H
M82P at 8CU.;VYE+" J87)G<RP@*BIK=RDZ("(H82P at 8CU.;VYE+" N+BXI(@T*
M#0H@(" @8VQA<W, at 5$,Z#0H@(" @(" @(&1E9B!T,2AS96QF*3H@(B at I(@T*
M(" @(" @("!D968@=#(H<V5L9BP at 82P@8CU.;VYE*3H@(BAA+"!B/4YO;F4I
M(@T*(" @(" @("!D968@=#,H<V5L9BP at 82P@*F%R9W,I.B B*&$L("XN+BDB
M#0H@(" @(" @(&1E9B!T-"AS96QF+" J87)G<RDZ("(H+BXN*2(-"B @(" @
M(" @9&5F('0U*'-E;&8L(&$L("IA<F=S*3H@(BAA+" N+BXI(@T*(" @(" @
M("!D968@=#8H<V5L9BP at 82P@8CU.;VYE+" J87)G<RP@*BIK=RDZ("(H82P@
M8CU.;VYE+" N+BXI(@T*#0H@(" @9&5F('1E<W0H('1E<W1S("DZ#0H@(" @
M(" @(&9A:6QE9#U;70T*(" @(" @("!F;W(@="!I;B!T97-T<SH-"B @(" @
M(" @(" @(&EF(&=E=%]A<F=?=&5X="AT*2 A/2!T+E]?9&]C7U\@*R B7&XB
M("L@="Y?7V1O8U]?. at T*(" @(" @(" @(" @(" @(&9A:6QE9"YA<'!E;F0H
M="D-"B @(" @(" @(" @(" @("!P<FEN=" B)7, at +2!E>'!E8W1E9" E<RP@
M8G5T(&=O=" E<R(@)2 H="P at 8'0N7U]D;V-?7V L(&!G971?87)G7W1E>'0H
M="E@*0T*(" @(" @("!P<FEN=" B)60@;V8@)60@=&5S=', at 9F%I;&5D(B E
M("AL96XH9F%I;&5D*2P@;&5N*'1E<W1S*2D-"@T*(" @('1C(#T at 5$,H*0T*
M(" @('1E<W1S(#T@=#$L('0R+"!T,RP@=#0L('0U+"!T-BP at 7 T*(" @(" @
M(" @(" @=&,N=#$L('1C+G0R+"!T8RYT,RP@=&,N=#0L('1C+G0U+"!T8RYT
6- at T*#0H@(" @=&5S="AT97-T<RD-"@``
`
end





More information about the Python-list mailing list