add more frames

a little progress in code.

i decided to add inheritance in widgets.
This commit is contained in:
lizhi-rocky
2010-07-08 17:35:07 +08:00
parent d1760bad48
commit b0a6b3d31d
3 changed files with 209 additions and 2 deletions

View File

@@ -52,3 +52,9 @@ def display_widget_sub(w, p_win):
def kill_widget(win):
''' win - Tk window instance '''
win.destroy()
def display_entry(w):
def display_listbox(w):
def display_radiobutton(w):

View File

@@ -52,7 +52,6 @@ class Widget:
for w in w_list:
self.widgets.append(Widget(w))
def widget_attribute(self, xml_node):
attr_list = [ a for a in xml_node.childNodes
if a.nodeType == a.ELEMENT_NODE and a.nodeName == "widget_attribute"]
@@ -70,6 +69,49 @@ class Widget:
d[a.name] = a.value
return d
def display(self):
display_widget(self)
class Label(Widget):
''' Label '''
def __init__(self, xml_node):
Widget.__init__(self, xml_node)
class Button(Widget):
''' Button '''
def __init__(self, xml_node):
Widget.__init__(self, xml_node)
class Frame(Widget):
''' Frame '''
def __init__(self, xml_node):
Widget.__init__(self, xml_node)
class Entry(Widget):
''' Entry '''
def __init__(self, xml_node):
Widget.__init__(self, xml_node)
def display(self):
display_entry(self)
class Listbox(Widget):
''' Listbox '''
def __init__(self, xml_node):
Widget.__init__(self, xml_node)
#### need add scroll bar
def display(self):
display_listbox(self)
class Radiobutton(Widget):
''' Radiobutton '''
def __init__(self, xml_node):
Widget.__init__(self, xml_node)
### need add radios
def display(self):
display_radiobutton(self)
def construct(xml_root):
''' construct Widget's static members'''