Keyboard Commands

Rich dick at charts.org
Mon Apr 21 21:36:15 EDT 2003


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?



QWE <leomasi at libero.it> wrote in message news:<81l7avg7r77ko9p80mggjlfdmb2bd98b51 at 4ax.com>...
> On Sun, 20 Apr 2003 18:27:21 -0500, "richard.a.charts.1"
> <charts at purdue.edu> wrote:
> 
> >Hey,
> >I'm working on a program and I want to use keyboard shortcuts for some of
> >my menu items.  I can't seem to find the way to implement this.  Can
> >anyone point me in the right direction?  ex.  Ctrl-x, ctrl-F1, etc.
> >
> >Thanks for any help.
> >And please feel free to email ur answers to me directly.
> >
> >Charts
> from Tkinter import *
> 
> root = Tk()
> 
> def hello():
>     print "Hello"
> 
> frame = Frame(root)
> root.bind("<Control-p>", lambda e: hello())
> Label(text="Press Controll-p").pack()
> frame.pack()
> 
> root.mainloop()




More information about the Python-list mailing list