added OptionMenu class (tk_optionMenu interface)

This commit is contained in:
Guido van Rossum 1995-09-01 20:35:37 +00:00
parent cf9e27c72e
commit bf4d8f9d87
2 changed files with 20 additions and 4 deletions

View File

@ -69,6 +69,7 @@ SEL_LAST='sel.last'
END='end'
INSERT='insert'
CURRENT='current'
ANCHOR='anchor'
def _flatten(tuple):
res = ()
@ -739,8 +740,7 @@ class Widget(Misc, Pack, Place):
cnf = _cnfmerge((cnf, kw))
self.widgetName = widgetName
Widget._setup(self, master, cnf)
extra1=()
apply(self.tk.call, extra1+(widgetName, self._w)+extra)
apply(self.tk.call, (widgetName, self._w)+extra)
if cnf:
Widget.config(self, cnf)
def config(self, cnf=None, **kw):
@ -1288,6 +1288,14 @@ class Text(Widget):
def yview_pickplace(self, *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:
def __init__(self, imgtype, name=None, cnf={}, **kw):
self.name = None

View File

@ -69,6 +69,7 @@ SEL_LAST='sel.last'
END='end'
INSERT='insert'
CURRENT='current'
ANCHOR='anchor'
def _flatten(tuple):
res = ()
@ -739,8 +740,7 @@ class Widget(Misc, Pack, Place):
cnf = _cnfmerge((cnf, kw))
self.widgetName = widgetName
Widget._setup(self, master, cnf)
extra1=()
apply(self.tk.call, extra1+(widgetName, self._w)+extra)
apply(self.tk.call, (widgetName, self._w)+extra)
if cnf:
Widget.config(self, cnf)
def config(self, cnf=None, **kw):
@ -1288,6 +1288,14 @@ class Text(Widget):
def yview_pickplace(self, *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:
def __init__(self, imgtype, name=None, cnf={}, **kw):
self.name = None