mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
Two independent changes:
- accept empty string from focus_get - map coords() return value through getdouble and splitlist
This commit is contained in:
parent
8d12a1bcbc
commit
c8b4791d9e
2 changed files with 6 additions and 4 deletions
|
@ -167,7 +167,7 @@ class Misc:
|
||||||
self.tk.call('focus', 'none')
|
self.tk.call('focus', 'none')
|
||||||
def focus_get(self):
|
def focus_get(self):
|
||||||
name = self.tk.call('focus')
|
name = self.tk.call('focus')
|
||||||
if name == 'none': return None
|
if name == 'none' or not Name: return None
|
||||||
return self._nametowidget(name)
|
return self._nametowidget(name)
|
||||||
def tk_focusNext(self):
|
def tk_focusNext(self):
|
||||||
name = self.tk.call('tk_focusNext', self._w)
|
name = self.tk.call('tk_focusNext', self._w)
|
||||||
|
@ -963,7 +963,8 @@ class Canvas(Widget):
|
||||||
return self.tk.getdouble(self.tk.call(
|
return self.tk.getdouble(self.tk.call(
|
||||||
self._w, 'canvasy', screeny, gridspacing))
|
self._w, 'canvasy', screeny, gridspacing))
|
||||||
def coords(self, *args):
|
def coords(self, *args):
|
||||||
return self._do('coords', args)
|
return map(self.tk.getdouble,
|
||||||
|
self.tk.splitlist(self._do('coords', args))
|
||||||
def _create(self, itemType, args, kw): # Args: (val, val, ..., cnf={})
|
def _create(self, itemType, args, kw): # Args: (val, val, ..., cnf={})
|
||||||
args = _flatten(args)
|
args = _flatten(args)
|
||||||
cnf = args[-1]
|
cnf = args[-1]
|
||||||
|
|
|
@ -167,7 +167,7 @@ class Misc:
|
||||||
self.tk.call('focus', 'none')
|
self.tk.call('focus', 'none')
|
||||||
def focus_get(self):
|
def focus_get(self):
|
||||||
name = self.tk.call('focus')
|
name = self.tk.call('focus')
|
||||||
if name == 'none': return None
|
if name == 'none' or not Name: return None
|
||||||
return self._nametowidget(name)
|
return self._nametowidget(name)
|
||||||
def tk_focusNext(self):
|
def tk_focusNext(self):
|
||||||
name = self.tk.call('tk_focusNext', self._w)
|
name = self.tk.call('tk_focusNext', self._w)
|
||||||
|
@ -963,7 +963,8 @@ class Canvas(Widget):
|
||||||
return self.tk.getdouble(self.tk.call(
|
return self.tk.getdouble(self.tk.call(
|
||||||
self._w, 'canvasy', screeny, gridspacing))
|
self._w, 'canvasy', screeny, gridspacing))
|
||||||
def coords(self, *args):
|
def coords(self, *args):
|
||||||
return self._do('coords', args)
|
return map(self.tk.getdouble,
|
||||||
|
self.tk.splitlist(self._do('coords', args))
|
||||||
def _create(self, itemType, args, kw): # Args: (val, val, ..., cnf={})
|
def _create(self, itemType, args, kw): # Args: (val, val, ..., cnf={})
|
||||||
args = _flatten(args)
|
args = _flatten(args)
|
||||||
cnf = args[-1]
|
cnf = args[-1]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue