473,587 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

tkinter text <Key> event

Jay
I'm having trouble with using the <Keyevent with the Text object.
When I use them together (which is a logical combination), I use this
code:

textbox = Text(root, wrap="word", height=15, width=50)
textbox.bind("< Key>", resolveGlyphs)

def resolveGlyphs(e vent):
textBuf = textbox.get(1.0 , END)
print(textBuf)

What it prints out for me is everything except for the last character
-- the one that triggered the event. How can I get the entire
contents?

I apologize if this has already been discussed. I searched and
couldn't find it.

Sep 7 '06 #1
3 2104
On Wed, 2006-09-06 at 17:54 -0700, Jay wrote:
I'm having trouble with using the <Keyevent with the Text object.
When I use them together (which is a logical combination), I use this
code:

textbox = Text(root, wrap="word", height=15, width=50)
textbox.bind("< Key>", resolveGlyphs)

def resolveGlyphs(e vent):
textBuf = textbox.get(1.0 , END)
print(textBuf)

What it prints out for me is everything except for the last character
-- the one that triggered the event. How can I get the entire
contents?
bind the textbox to the <KeyReleaseeven t because by then it has been
drawn on the Text widget. The <Keyevent is equivalent to the
<KeyPresseven t

Regards,

John

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Sep 7 '06 #2
Jay
That makes sense, but it's not working.
John McMonagle wrote:
On Wed, 2006-09-06 at 17:54 -0700, Jay wrote:
I'm having trouble with using the <Keyevent with the Text object.
When I use them together (which is a logical combination), I use this
code:

textbox = Text(root, wrap="word", height=15, width=50)
textbox.bind("< Key>", resolveGlyphs)

def resolveGlyphs(e vent):
textBuf = textbox.get(1.0 , END)
print(textBuf)

What it prints out for me is everything except for the last character
-- the one that triggered the event. How can I get the entire
contents?

bind the textbox to the <KeyReleaseeven t because by then it has been
drawn on the Text widget. The <Keyevent is equivalent to the
<KeyPresseven t

Regards,

John

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Sep 8 '06 #3
Jay
Nevermind. It works. Sorry. I got my files mixed up! :-)
John McMonagle wrote:
On Wed, 2006-09-06 at 17:54 -0700, Jay wrote:
I'm having trouble with using the <Keyevent with the Text object.
When I use them together (which is a logical combination), I use this
code:

textbox = Text(root, wrap="word", height=15, width=50)
textbox.bind("< Key>", resolveGlyphs)

def resolveGlyphs(e vent):
textBuf = textbox.get(1.0 , END)
print(textBuf)

What it prints out for me is everything except for the last character
-- the one that triggered the event. How can I get the entire
contents?

bind the textbox to the <KeyReleaseeven t because by then it has been
drawn on the Text widget. The <Keyevent is equivalent to the
<KeyPresseven t

Regards,

John

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Sep 8 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3591
by: wang xiaoyu | last post by:
Hello,everyone. my program runs well in windows,i use tkSimpleDialog to receive some input,but when i copy my program into Linux RH8.0,entrys in my tkSimpleDialog derived Dialog have a vital problem:only one entry can receive key event,'tab' key to navigate between entrys is not valid too,when i use mouse to focus a entry(which can not...
1
4053
by: Raghul | last post by:
hi, I am developing a jabber client.What I need is whrn i enter text in the text area and when I press return key. The following text should be send.I found the way to send the message, the only thing is I want to handle the enter key event.how to do this? so that when i press enter key, The key id or the event to be handled. Help me pls.
0
1802
by: Markus Seibold | last post by:
Hello NG, sorry for pasting that much code but I just can't figure out how get the <key><keyref> to work in XML Schema. I am using XMLSpy 4.3 for editing my XML. I want to represent a recursive 1:n relationship between a database table AdminUnit (i.e., States consist of Counties).
1
2283
by: I am dog | last post by:
Hi , I use VS 2005 beta1 to do some thing as follows. declare a Dictionary<ulong,DelegateTyep> dictionary = new ... and use dictionary object such as dictionary += aDelegateTyepObject;
1
2339
by: Keith | last post by:
Hi, I created a dataset during run time and assigned it to the datagrid. But i cant get the FindBy<Key> method to work. During design time, i got a error "dtProdHdr is not a member of System.Data.DataSet" error Is it that FindBy<Key> method is used only for DataSet generated during design time by the wizard? Can i actually use FindBy<Key>...
0
1035
by: KatB | last post by:
I have an aspx page with a button on it (Button1), and a ascx control with a text field and a button (Button2). When I click Button2, Button1 fires. Since ascx doesn't allow <form> tags, I can't figure out how to fix this. I've searched for a solution with no luck, except one posting here which was too complicated for me. Thanks, Kat
1
1295
pankajkmeena
by: pankajkmeena | last post by:
is it possible to capture control+alt+<any key> in PHP
6
3555
pankajkmeena
by: pankajkmeena | last post by:
is it possible to capture control+alt+<any key> in javascript
10
1599
dmjpro
by: dmjpro | last post by:
Actually what i am trying to do that is to search some data as per users' entries. Firstly i am fetching the whole data from the database and keeping in a hidden table then as user gives the search string then i manipulate from the hidden table and displaying those into visible one. Now suppose i have huge data and i am performing sequential...
0
7923
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.