mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
Add Widget.unbind and {Canvas,Text}.tag_unbind.
In Widget.__init__, call config only if cnf not empty.
This commit is contained in:
parent
16d6e7109d
commit
ef8f88101a
2 changed files with 18 additions and 4 deletions
|
@ -316,6 +316,8 @@ class Misc:
|
||||||
self.tk.call('update')
|
self.tk.call('update')
|
||||||
def update_idletasks(self):
|
def update_idletasks(self):
|
||||||
self.tk.call('update', 'idletasks')
|
self.tk.call('update', 'idletasks')
|
||||||
|
def unbind(self, sequence):
|
||||||
|
self.tk.call('bind', self._w, sequence, '')
|
||||||
def bind(self, sequence, func, add=''):
|
def bind(self, sequence, func, add=''):
|
||||||
if add: add = '+'
|
if add: add = '+'
|
||||||
name = self._register(func, self._substitute)
|
name = self._register(func, self._substitute)
|
||||||
|
@ -644,7 +646,8 @@ class Widget(Misc, Pack, Place):
|
||||||
Widget._setup(self, master, cnf)
|
Widget._setup(self, master, cnf)
|
||||||
self.widgetName = widgetName
|
self.widgetName = widgetName
|
||||||
apply(self.tk.call, (widgetName, self._w) + extra)
|
apply(self.tk.call, (widgetName, self._w) + extra)
|
||||||
Widget.config(self, cnf)
|
if cnf:
|
||||||
|
Widget.config(self, cnf)
|
||||||
def config(self, cnf=None):
|
def config(self, cnf=None):
|
||||||
cnf = _cnfmerge(cnf)
|
cnf = _cnfmerge(cnf)
|
||||||
if cnf is None:
|
if cnf is None:
|
||||||
|
@ -749,7 +752,9 @@ class Canvas(Widget):
|
||||||
self.addtag('withtag', tagOrId)
|
self.addtag('withtag', tagOrId)
|
||||||
def bbox(self, *args):
|
def bbox(self, *args):
|
||||||
return self._getints(self._do('bbox', args)) or None
|
return self._getints(self._do('bbox', args)) or None
|
||||||
def bind(self, tagOrId, sequence, func, add=''):
|
def tag_unbind(self, tagOrId, sequence):
|
||||||
|
self.tk.call(self._w, 'bind', tagOrId, sequence, '')
|
||||||
|
def tag_bind(self, tagOrId, sequence, func, add=''):
|
||||||
if add: add='+'
|
if add: add='+'
|
||||||
name = self._register(func, self._substitute)
|
name = self._register(func, self._substitute)
|
||||||
self.tk.call(self._w, 'bind', tagOrId, sequence,
|
self.tk.call(self._w, 'bind', tagOrId, sequence,
|
||||||
|
@ -1101,6 +1106,8 @@ class Text(Widget):
|
||||||
def tag_add(self, tagName, index1, index2=None):
|
def tag_add(self, tagName, index1, index2=None):
|
||||||
self.tk.call(
|
self.tk.call(
|
||||||
self._w, 'tag', 'add', tagName, index1, index2)
|
self._w, 'tag', 'add', tagName, index1, index2)
|
||||||
|
def tag_unbind(self, tagName, sequence):
|
||||||
|
self.tk.call(self._w, 'tag', 'bind', tagName, sequence, '')
|
||||||
def tag_bind(self, tagName, sequence, func, add=''):
|
def tag_bind(self, tagName, sequence, func, add=''):
|
||||||
if add: add='+'
|
if add: add='+'
|
||||||
name = self._register(func, self._substitute)
|
name = self._register(func, self._substitute)
|
||||||
|
|
|
@ -316,6 +316,8 @@ class Misc:
|
||||||
self.tk.call('update')
|
self.tk.call('update')
|
||||||
def update_idletasks(self):
|
def update_idletasks(self):
|
||||||
self.tk.call('update', 'idletasks')
|
self.tk.call('update', 'idletasks')
|
||||||
|
def unbind(self, sequence):
|
||||||
|
self.tk.call('bind', self._w, sequence, '')
|
||||||
def bind(self, sequence, func, add=''):
|
def bind(self, sequence, func, add=''):
|
||||||
if add: add = '+'
|
if add: add = '+'
|
||||||
name = self._register(func, self._substitute)
|
name = self._register(func, self._substitute)
|
||||||
|
@ -644,7 +646,8 @@ class Widget(Misc, Pack, Place):
|
||||||
Widget._setup(self, master, cnf)
|
Widget._setup(self, master, cnf)
|
||||||
self.widgetName = widgetName
|
self.widgetName = widgetName
|
||||||
apply(self.tk.call, (widgetName, self._w) + extra)
|
apply(self.tk.call, (widgetName, self._w) + extra)
|
||||||
Widget.config(self, cnf)
|
if cnf:
|
||||||
|
Widget.config(self, cnf)
|
||||||
def config(self, cnf=None):
|
def config(self, cnf=None):
|
||||||
cnf = _cnfmerge(cnf)
|
cnf = _cnfmerge(cnf)
|
||||||
if cnf is None:
|
if cnf is None:
|
||||||
|
@ -749,7 +752,9 @@ class Canvas(Widget):
|
||||||
self.addtag('withtag', tagOrId)
|
self.addtag('withtag', tagOrId)
|
||||||
def bbox(self, *args):
|
def bbox(self, *args):
|
||||||
return self._getints(self._do('bbox', args)) or None
|
return self._getints(self._do('bbox', args)) or None
|
||||||
def bind(self, tagOrId, sequence, func, add=''):
|
def tag_unbind(self, tagOrId, sequence):
|
||||||
|
self.tk.call(self._w, 'bind', tagOrId, sequence, '')
|
||||||
|
def tag_bind(self, tagOrId, sequence, func, add=''):
|
||||||
if add: add='+'
|
if add: add='+'
|
||||||
name = self._register(func, self._substitute)
|
name = self._register(func, self._substitute)
|
||||||
self.tk.call(self._w, 'bind', tagOrId, sequence,
|
self.tk.call(self._w, 'bind', tagOrId, sequence,
|
||||||
|
@ -1101,6 +1106,8 @@ class Text(Widget):
|
||||||
def tag_add(self, tagName, index1, index2=None):
|
def tag_add(self, tagName, index1, index2=None):
|
||||||
self.tk.call(
|
self.tk.call(
|
||||||
self._w, 'tag', 'add', tagName, index1, index2)
|
self._w, 'tag', 'add', tagName, index1, index2)
|
||||||
|
def tag_unbind(self, tagName, sequence):
|
||||||
|
self.tk.call(self._w, 'tag', 'bind', tagName, sequence, '')
|
||||||
def tag_bind(self, tagName, sequence, func, add=''):
|
def tag_bind(self, tagName, sequence, func, add=''):
|
||||||
if add: add='+'
|
if add: add='+'
|
||||||
name = self._register(func, self._substitute)
|
name = self._register(func, self._substitute)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue