[ python-Bugs-1191726 ] about shift key

SourceForge.net noreply at sourceforge.net
Tue Oct 4 07:38:35 CEST 2005


Bugs item #1191726, was opened at 2005-04-28 07:38
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1191726&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tkinter
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: Neal Norwitz (nnorwitz)
Date: 2005-10-03 22:38

Message:
Logged In: YES 
user_id=33168

In order to preserve formatting, it's best to attach a file
which contains the problem.

----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-06-01 13:07

Message:
Logged In: YES 
user_id=1188172

I can reproduce this here with Py2.4.1 on WinXP.
With Py2.4.1/2.3.5 and Tk 8.4.9 using Linux, there's no problem.

Could this be a Tk problem?

In any case, updating metadata.

----------------------------------------------------------------------

Comment By: yang (leeews)
Date: 2005-04-29 04: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-28 17: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=105470&aid=1191726&group_id=5470


More information about the Python-bugs-list mailing list