mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
added OptionMenu class (tk_optionMenu interface)
This commit is contained in:
parent
cf9e27c72e
commit
bf4d8f9d87
2 changed files with 20 additions and 4 deletions
|
@ -69,6 +69,7 @@ SEL_LAST='sel.last'
|
||||||
END='end'
|
END='end'
|
||||||
INSERT='insert'
|
INSERT='insert'
|
||||||
CURRENT='current'
|
CURRENT='current'
|
||||||
|
ANCHOR='anchor'
|
||||||
|
|
||||||
def _flatten(tuple):
|
def _flatten(tuple):
|
||||||
res = ()
|
res = ()
|
||||||
|
@ -739,8 +740,7 @@ class Widget(Misc, Pack, Place):
|
||||||
cnf = _cnfmerge((cnf, kw))
|
cnf = _cnfmerge((cnf, kw))
|
||||||
self.widgetName = widgetName
|
self.widgetName = widgetName
|
||||||
Widget._setup(self, master, cnf)
|
Widget._setup(self, master, cnf)
|
||||||
extra1=()
|
apply(self.tk.call, (widgetName, self._w)+extra)
|
||||||
apply(self.tk.call, extra1+(widgetName, self._w)+extra)
|
|
||||||
if cnf:
|
if cnf:
|
||||||
Widget.config(self, cnf)
|
Widget.config(self, cnf)
|
||||||
def config(self, cnf=None, **kw):
|
def config(self, cnf=None, **kw):
|
||||||
|
@ -1288,6 +1288,14 @@ class Text(Widget):
|
||||||
def yview_pickplace(self, *what):
|
def yview_pickplace(self, *what):
|
||||||
apply(self.tk.call, (self._w, 'yview', '-pickplace')+what)
|
apply(self.tk.call, (self._w, 'yview', '-pickplace')+what)
|
||||||
|
|
||||||
|
class OptionMenu(Widget):
|
||||||
|
def __init__(self, master, variable, value, *values):
|
||||||
|
self.widgetName = 'tk_optionMenu'
|
||||||
|
Widget._setup(self, master, {})
|
||||||
|
self.menuname = apply(
|
||||||
|
self.tk.call,
|
||||||
|
(self.widgetName, self._w, variable, value) + values)
|
||||||
|
|
||||||
class Image:
|
class Image:
|
||||||
def __init__(self, imgtype, name=None, cnf={}, **kw):
|
def __init__(self, imgtype, name=None, cnf={}, **kw):
|
||||||
self.name = None
|
self.name = None
|
||||||
|
|
|
@ -69,6 +69,7 @@ SEL_LAST='sel.last'
|
||||||
END='end'
|
END='end'
|
||||||
INSERT='insert'
|
INSERT='insert'
|
||||||
CURRENT='current'
|
CURRENT='current'
|
||||||
|
ANCHOR='anchor'
|
||||||
|
|
||||||
def _flatten(tuple):
|
def _flatten(tuple):
|
||||||
res = ()
|
res = ()
|
||||||
|
@ -739,8 +740,7 @@ class Widget(Misc, Pack, Place):
|
||||||
cnf = _cnfmerge((cnf, kw))
|
cnf = _cnfmerge((cnf, kw))
|
||||||
self.widgetName = widgetName
|
self.widgetName = widgetName
|
||||||
Widget._setup(self, master, cnf)
|
Widget._setup(self, master, cnf)
|
||||||
extra1=()
|
apply(self.tk.call, (widgetName, self._w)+extra)
|
||||||
apply(self.tk.call, extra1+(widgetName, self._w)+extra)
|
|
||||||
if cnf:
|
if cnf:
|
||||||
Widget.config(self, cnf)
|
Widget.config(self, cnf)
|
||||||
def config(self, cnf=None, **kw):
|
def config(self, cnf=None, **kw):
|
||||||
|
@ -1288,6 +1288,14 @@ class Text(Widget):
|
||||||
def yview_pickplace(self, *what):
|
def yview_pickplace(self, *what):
|
||||||
apply(self.tk.call, (self._w, 'yview', '-pickplace')+what)
|
apply(self.tk.call, (self._w, 'yview', '-pickplace')+what)
|
||||||
|
|
||||||
|
class OptionMenu(Widget):
|
||||||
|
def __init__(self, master, variable, value, *values):
|
||||||
|
self.widgetName = 'tk_optionMenu'
|
||||||
|
Widget._setup(self, master, {})
|
||||||
|
self.menuname = apply(
|
||||||
|
self.tk.call,
|
||||||
|
(self.widgetName, self._w, variable, value) + values)
|
||||||
|
|
||||||
class Image:
|
class Image:
|
||||||
def __init__(self, imgtype, name=None, cnf={}, **kw):
|
def __init__(self, imgtype, name=None, cnf={}, **kw):
|
||||||
self.name = None
|
self.name = None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue