python Tkinter bind 2.7.9 w-d -


hello having problems binding w+d in code. see how ctrl+/ , stuff different use 2 letters? have tried few different way here line use.

root.bind('w-d',lambda x: upleftc()) 

it's bit unclear you're trying accomplish, if you're trying bind combination of letter "w" followed letter "d", bind two-event sequence "<w><d>", or more simply, "wd".

for definitive documentation on how specify events, see section "event patterns" in official tcl/tk documentation.

here example:

import tkinter tk  class example(tk.frame):     def __init__(self, parent):         tk.frame.__init__(self, parent)          self.entry = tk.entry(self)         self.entry.pack(fill="x")          self.entry.bind("<w><d>", self.onwd)         # alternatively: self.entry.bind("wd", self.onwd)      def onwd(self, event):         print "boom!"  if __name__ == "__main__":     root = tk.tk()     example(root).pack(fill="both", expand=true)     root.mainloop() 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -