This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: about shift key
Type: Stage:
Components: Tkinter Versions: Python 2.4
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, gpolo, isandler, leeews, nnorwitz
Priority: normal Keywords:

Created on 2005-04-28 14:38 by leeews, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue1191726.py gpolo, 2008-11-24 13:36
test1.tcl gpolo, 2008-11-24 13:36
Messages (6)
msg25170 - (view) Author: yang (leeews) Date: 2005-04-28 14:38
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.
msg25171 - (view) Author: Ilya Sandler (isandler) Date: 2005-04-29 00:46
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
msg25172 - (view) Author: yang (leeews) Date: 2005-04-29 11:47
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
msg25173 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-06-01 20:07
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.
msg25174 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2005-10-04 05:38
Logged In: YES 
user_id=33168

In order to preserve formatting, it's best to attach a file
which contains the problem.
msg76323 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008-11-24 13:36
I can reproduce this under windows vista with tk8.4 and tk8.5, but the
problem doesn't show up in Linux and it is not tkinter fault either.
History
Date User Action Args
2022-04-11 14:56:11adminsetgithub: 41921
2008-11-24 13:38:41gpolosetstatus: open -> closed
resolution: wont fix
2008-11-24 13:36:10gpolosetfiles: + test1.tcl
2008-11-24 13:36:01gpolosetfiles: + issue1191726.py
nosy: + gpolo
messages: + msg76323
2005-04-28 14:38:31leeewscreate