[Patches] [ python-Patches-1191726 ] about shift key
SourceForge.net
noreply at sourceforge.net
Fri Apr 29 13:47:21 CEST 2005
Patches item #1191726, was opened at 2005-04-28 22:38
Message generated for change (Comment added) made by leeews
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1191726&group_id=5470
Category: Library (Lib)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: yang (leeews)
Assigned to: Nobody/Anonymous (nobody)
Summary: about shift key
Initial Comment:
I'v wrote the following program
------------------------------------------------------------------------------
from Tkinter import *
class KeyDemo(Frame):
""""""
def __init__(self):
""""""
Frame.__init__(self)
self.pack(expand=YES,fill=BOTH)
self.master.title("Demonstrating Keystroke Events")
self.master.geometry("350x100")
self.message1=StringVar()
self.line1=Label(self,textvariable=self.message1)
self.message1.set("Type any key or shift")
self.line1.pack()
self.message2=StringVar()
self.line2=Label(self,textvariable=self.message2)
self.message2.set("")
self.line2.pack()
self.master.bind("<KeyPress>",self.keyPressed)
self.master.bind("<KeyRelease>",self.keyReleased)
self.master.bind("<KeyPress-Shift_L>",self.shiftPressed)
self.master.bind("<KeyRelease-Shift_L>",self.shiftReleased)
def keyPressed(self,event):
""""""
self.message1.set("Key pressed: "+ event.char)
self.message2.set("This key is not left shift")
def keyReleased(self,event):
""""""
self.message1.set("Key released: "+ event.char)
self.message2.set("This key is not left shift")
def shiftPressed(self,event):
""""""
self.message1.set("Shift pressed")
self.message2.set("This key is left shift")
def shiftReleased(self,event):
""""""
self.message1.set("Shift released")
self.message2.set("This key is left shift")
def main():
KeyDemo().mainloop()
if __name__=="__main__":
main()
--------------------------------------------------------------------------
When I pressed right shift , it shows:
Key pressed:
This key is not left shift
And when I released right shift ,it shows:
Shift released
This key is left shift
But what I release is right shift.
----------------------------------------------------------------------
>Comment By: yang (leeews)
Date: 2005-04-29 19:47
Message:
Logged In: YES
user_id=1268579
sorry,I'll be minimize my code sample next time
my code had formatted correctly when I edit it,but when I
post it , The spaces for format control had disappeared.
my platform is python 2.4 /winXP
This is the first time I report bug, so I don't know what is
the correct way. sorry to trouble you
----------------------------------------------------------------------
Comment By: Ilya Sandler (isandler)
Date: 2005-04-29 08:46
Message:
Logged In: YES
user_id=971153
This seems like a bug (not a patch) report..
So I guess it might be a good idea to close it and refile as
a bug...
And a few more suggestions:
--try to minimize your code sample
--make sure that your sample code is formatted correctly
in your post
--please indicate what platform/OS you are using
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1191726&group_id=5470
More information about the Patches
mailing list