Keyboard Commands

QWE leomasi at libero.it
Tue Apr 22 13:10:57 EDT 2003


On 21 Apr 2003 18:36:15 -0700, dick at charts.org (Rich) wrote:

>OK that helps some but it still isn't working perfectly.
>is this right:
>
>    self.Game.bind('<Control-h>',self.HighlightKey())
>
>    def HighlightKey(self):
>        self.FileOptionsHelp.Highlight()
>     	if self.Yote.HighlightEnable == 1:
>	    self.FileOptionsHelp.Highset.set(1)
>        else:
>	    self.FileOptionsHelp.Highset.set(0)
>    def Highlight(self):
>        if self.GameScreen.Yote.HighlightEnable == 1:
>            self.GameScreen.Yote.HighlightEnable = 0
>        else:
>            self.GameScreen.Yote.HighlightEnable = 1
>
>
>Shouldn't hitting ctrl-h cause HighlitghtEnable to switch values?

try
self.Game.bind('<Control-h>', self.HighlightKey)

or
self.Game.bind('<Control-h>', lambda e: self.HighlightKey())

if is not work, see chapter 7 of 'An Introduction to Tkinter'




More information about the Python-list mailing list