mirror of
https://github.com/python/cpython.git
synced 2025-11-10 14:31:24 +00:00
(Menu.index): return int or None, not string
(Widget.__getitem__): use splitlist, not split
This commit is contained in:
parent
7152740076
commit
c2fb7e65de
2 changed files with 8 additions and 4 deletions
|
|
@ -528,7 +528,7 @@ class Widget(Misc, Pack, Place):
|
||||||
apply(self.tk.call, (self._w, 'configure')
|
apply(self.tk.call, (self._w, 'configure')
|
||||||
+ self._options(cnf))
|
+ self._options(cnf))
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
v = self.tk.split(self.tk.call(
|
v = self.tk.splitlist(self.tk.call(
|
||||||
self._w, 'configure', '-' + key))
|
self._w, 'configure', '-' + key))
|
||||||
return v[4]
|
return v[4]
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
|
|
@ -877,7 +877,9 @@ class Menu(Widget):
|
||||||
apply(self.tk.call, (self._w, 'entryconfigure', index)
|
apply(self.tk.call, (self._w, 'entryconfigure', index)
|
||||||
+ self._options(cnf))
|
+ self._options(cnf))
|
||||||
def index(self, index):
|
def index(self, index):
|
||||||
return self.tk.call(self._w, 'index', index)
|
i = self.tk.call(self._w, 'index', index)
|
||||||
|
if i == 'none': return None
|
||||||
|
return self.tk.getint(i)
|
||||||
def invoke(self, index):
|
def invoke(self, index):
|
||||||
return self.tk.call(self._w, 'invoke', index)
|
return self.tk.call(self._w, 'invoke', index)
|
||||||
def post(self, x, y):
|
def post(self, x, y):
|
||||||
|
|
|
||||||
|
|
@ -528,7 +528,7 @@ class Widget(Misc, Pack, Place):
|
||||||
apply(self.tk.call, (self._w, 'configure')
|
apply(self.tk.call, (self._w, 'configure')
|
||||||
+ self._options(cnf))
|
+ self._options(cnf))
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
v = self.tk.split(self.tk.call(
|
v = self.tk.splitlist(self.tk.call(
|
||||||
self._w, 'configure', '-' + key))
|
self._w, 'configure', '-' + key))
|
||||||
return v[4]
|
return v[4]
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
|
|
@ -877,7 +877,9 @@ class Menu(Widget):
|
||||||
apply(self.tk.call, (self._w, 'entryconfigure', index)
|
apply(self.tk.call, (self._w, 'entryconfigure', index)
|
||||||
+ self._options(cnf))
|
+ self._options(cnf))
|
||||||
def index(self, index):
|
def index(self, index):
|
||||||
return self.tk.call(self._w, 'index', index)
|
i = self.tk.call(self._w, 'index', index)
|
||||||
|
if i == 'none': return None
|
||||||
|
return self.tk.getint(i)
|
||||||
def invoke(self, index):
|
def invoke(self, index):
|
||||||
return self.tk.call(self._w, 'invoke', index)
|
return self.tk.call(self._w, 'invoke', index)
|
||||||
def post(self, x, y):
|
def post(self, x, y):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue