From the archive at http://EmpowermentZone.com/pyLbc.zip I have developed a Python module called Layout by Code (lbc), which simplifies design of dialogs with the wxPython package available from http://wxPython.org This is another implementation of the Layout by Code approach that I originally developed for the AutoIt language, http://EmpowermentZone.com/lbc.zip Although the Python version is not as flexible, it is still intended to support most dialogs one might need (based on years of experience with various applications and languages). It should work with Python 2.4, 2.5, or 2.6. After instantiating an lbc dialog object, any of the following controls may be added with a line of code: Button, CheckBox, ListBox, RadioButton, RichEdit, StaticText, or TextCtrl. The control is added to a horizontal band of controls, with layout automatically managed by wxSizer containers. Adding a new band is analagous to pressing carriage return at the end of a line. The lbc ShowModal method adds a band of buttons at the bottom of the dialog before invoking it. The method returns the ID of the button that ended the dialog. At that point, the dialog object has a list attribute called Controls, containing the names of controls that were added to the dialog before it was invoked. A control name is its class and label, if any, seperated by an underscore, e.g., Button_OK. The dialog also has a dictionary attribute called Results, containing the control names and values when the dialog ended. Over ten convenience dialogs have been defined using lbc, illustrated with the program test_lbc.py. Also, a fruit basket program is in lbc_fruit.py. Below is a summary of lbc functions, followed by the fruit basket example. Jamal DialogBrowseForFolder(message='', value='') -- Select a folder DialogChoose(title='Choose', message = '', names=[]) -- Choose a button DialogConfirm(title='Confirm', message='', value='Y') -- Choose from a Yes/No/Cancel message box DialogInput(title='Input', label='', value='', ) -- Input with a single-line edit box DialogMemo(title='Memo', label='', value='', readonly=False) -- Input or read text with a multiple-line edit box DialogMultiInput(title='MultiInput', labels=[], values=[], options=[]) -- Input with multiple edit boxes DialogMultiPick(title='Multi Pick', message='', names=[], values=[], sort=False, index=0) -- Pick from a multiple-selection listbox DialogOpenFile(message='', value='', wildcard='All files (*.*)|*.*') -- Specify a file to open DialogPick(title='Pick', message='', names=[], values=[], sort=False, index=0) -- Pick from a single-selection listbox DialogSaveFile(message='', value='', wildcard='All files (*.*)|*.*') -- Specify a file to save DialogShow(title='Show', message='') -- Show a message AddBand(self) AddButtonBand(buttons=[], handler=None) AddButton(label='', pos=wx.DefaultPosition, size=wx.DefaultSize, style=DEFAULT_STYLE, name='') AddCheckBox(label='', value=False, pos=wx.DefaultPosition, size=wx.DefaultSize, style=DEFAULT_STYLE, name='') AddListBox(label='', names=[], values=[], sort=False, pos=wx.DefaultPosition, size=wx.DefaultSize, style=DEFAULT_STYLE, name='') AddRadioButton(label='', value=False, pos=wx.DefaultPosition, size=wx.DefaultSize, style=DEFAULT_STYLE, name='') AddRichEdit(label='', value='', readonly=False, pos=wx.DefaultPosition, size=wx.DefaultSize, style= wx.TE_MULTILINE | wx.TE_PROCESS_ENTER | wx.TE_RICH2, name='') AddStaticText(label='', pos=wx.DefaultPosition, size=wx.DefaultSize, style=DEFAULT_STYLE, name='') AddTextCtrl(label='', value='', pos=wx.DefaultPosition, size=wx.DefaultSize, style=DEFAULT_STYLE, name='') ShowModal(buttons = ['OK', 'Cancel'], handler=None) """ Fruit basket program in Python with lbc Public domain by Jamal Mazrui """ import wx, lbc # Custom event handler def OnEvent(dlg, event): if event.GetEventType() in wx.EVT_CLOSE.evtType: if lbc.DialogConfirm(title='Confirm', message='Exit program?', value='Y') == 'Y': return event.Skip() else: return event.Veto() wgt = event.GetEventObject() txt = dlg.FindWindowByName('TextCtrl_Fruit') lst = dlg.FindWindowByName('ListBox_Basket') if wgt.GetName() == 'Button_Add': fruit = txt.GetValue() if len(fruit) == 0: return lbc.DialogShow(title='Alert', message='No fruit to add!') lst.Append(fruit) index = lst.GetCount() - 1 lst.SetSelection(index) txt.Clear() elif wgt.GetName() == 'Button_Delete': index = lst.GetSelection() if index == -1: return lbc.DialogShow(title='Alert', message='No fruit to delete!') lst.Delete(index) if index == lst.GetCount(): index -= 1 if index >= 0: lst.SetSelection(index) # Main program app = lbc.App() dlg = lbc.Dialog(title='Fruit Basket') dlg.AddTextCtrl(label='Fruit:') dlg.AddListBox(label='Basket:') dlg.ShowModal(buttons=['Add', 'Delete'], handler=OnEvent) app.Exit() __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind