473,394 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Unbind initial bind on basic widget (text)

Hi,
Do I can unbind the initial bind on basic widget? (ex.: the basic widget
Text have the bind "<Control-a>" for the return to the first caracter of
the line; but me I don't want this!)
I try 'myText.unbind("<Control-a>")' but the bind is not remove.
:-(
Askari

N.B. I wan't disabled ALL initial bind (not just the "<Control-a>")
Jul 18 '05 #1
3 2042
Askari wrote:
Do I can unbind the initial bind on basic widget? (ex.: the basic
widget
Text have the bind "<Control-a>" for the return to the first caracter of
the line; but me I don't want this!)
I try 'myText.unbind("<Control-a>")' but the bind is not remove.
:-(
I see two options.

1. Prevent the event from being propagated to the class.

def breaker(*args):
return "break"

mytext.bind("<Control-a>", breaker)

2. Unbind the event on the class level.

mytext.unbind_class("Text", "<Control-a>")
N.B. I wan't disabled ALL initial bind (not just the "<Control-a>")


Maybe you should just disable the widget?

mytext["state"] = "disabled"

Peter
Jul 18 '05 #2
You should probably read the Tk manpage on the bind and bindtags
commands.

If you want to get rid of all the normal bindings for a Text widget, you
can just do something like
tags = myText.bindtags()
tags.remove("Text")
myText.bindtags(tags)

If you want to stop only certain bindings, use the "break" technique
mentioned in another response to your post.

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAy64FJd01MZaTXX0RAsvrAJ4yI+7QYEN0i2iS9s9SvB GNIuayRACeJb5s
PjfGZWjPiWqoLHuAxtAcXj4=
=Xaum
-----END PGP SIGNATURE-----

Jul 18 '05 #3
Peter Otten <__*******@web.de> wrote in
news:ca*************@news.t-online.com:
Askari wrote:
Do I can unbind the initial bind on basic widget? (ex.: the basic
widget
Text have the bind "<Control-a>" for the return to the first caracter
of the line; but me I don't want this!)
I try 'myText.unbind("<Control-a>")' but the bind is not
remove.
:-(


I see two options.

1. Prevent the event from being propagated to the class.

def breaker(*args):
return "break"

mytext.bind("<Control-a>", breaker)

2. Unbind the event on the class level.

mytext.unbind_class("Text", "<Control-a>")
N.B. I wan't disabled ALL initial bind (not just the "<Control-a>")


Maybe you should just disable the widget?

mytext["state"] = "disabled"

Peter


Thanks!! :-)
Jul 18 '05 #4

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

Similar topics

8
by: Harlin Seritt | last post by:
I have the following script. Two widgets call the same function. How can I tell inside of the called function which button called it?: def say_hello(): print 'hello!' print widget root =...
1
by: Ethan | last post by:
I am finding that the "font-family" property is not respected by NN 4.79 on the PC. However, various documentation sources say that "font-family" IS supported in Netscape. For example: p {...
1
by: Blake Versiga | last post by:
How do i set the focus on a Textbox upon initial display of the page?
3
by: Lori Markle via .NET 247 | last post by:
(Type your message here) Hi, I'm having a problem with binding a textbox to a dataset. Cananybody figure out what's going on here? I simply want to update a record. Type in a permit number...
0
by: Monty M. | last post by:
Hello; I am new to using WinFx and I am having trouble figuring out how to bind a text box to a field in a dataset. I found an MSDN article:...
2
by: rahulnag22 | last post by:
Hi, I guess this is a very trivial question -- I am using a label widget to display text (black font in a white background color). I am trying to use my mouse to scroll over the displayed text to...
0
by: sean worlock | last post by:
Hello all, I have googled like crazy for this with no sucess! I have a dataset containing a table with the following fields Table===Widths ---------------------------------------------...
0
by: Alex Bryan | last post by:
Hey guys. I am having trouble understanding the get() method from the Tkinter Text() widget. It isn't like the entry.get() one I am used to. I know you have to put tags in, or at least I read. I...
0
by: John McMoangle | last post by:
Hey guys. I am having trouble understanding the get() method from The arguments to the get method of the Text widget are strings in the form of "line.position". So, text.get('1.5', '2.7')...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.