From the archive http://www.EmpowermentZone.com/py_fruit.zip This fruit basket program is written in Python 2.5, available from http://python.org with wrappers for WxWidgets 2.8, available from http://wxwidgets.org I revised the original fruit basket program I did in Python to one that is more concise and readable. The coding process benefited from a new feature in EdSharp, available from http://www.EmpowermentZone.com/edsetup.exe that allows one to toggle between standard Python syntax and a pilot variation intended to be easier for users of speech output. I call this variation "PyBrace," since it uses curly braces instead of indentation to denote blocks of code. PyBrace conventions currently use an opening brace instead of a colon, and a closing brace on a line by itself at the end of the block. In addition, a word immediately follows the closing brace, which is the same word that started the code block, e.g., "if" or "def." The standard Python version also follows some conventions in order to have a line for line equivalence with the PyBrace version. This helps one find the line to revise when the Python interpreter produces an error message. The Python comment symbol, #, replaces the closing brace character at the end of a block. The word immediately after reminds a speech user what block has ended. Using a convention of a single word after the # symbol enables EdSharp to eliminate these comments and regenerate them each time a conversion is done. Manually written comments that put a space after the # symbol or involve more than one word will not be affected by the conversion process. In EdSharp, the PyBrace command is available on the Miscellaneous menu, or via the Alt+Shift+LeftBracket hot key. It converts either all or selected text to PyBrace format, coming from general Python or PyDent format. The PyDent command, Alt+LeftBracket, does the reverse, converting to PyDent from PyBrace. For comparison, below is the PyBrace followed by PyDent version -- the latter being the one to run as a command-line argument with the Python interpreter. Jamal # Begin content of py_fruit.pyb # Fruit Basket program in PyBrace with WxWidgets # Public domain by Jamal Mazrui import wx def Add_Click(self){ sFruit = txtFruit.GetValue() if len(sFruit ) == 0{ wx.MessageBox("No fruit to add!", "Alert") }if else{ lstBasket.Append(sFruit) iFruit = lstBasket.GetCount() - 1 lstBasket.SetSelection(iFruit) txtFruit.Clear() }else }def def Delete_Click(self){ iFruit = lstBasket.GetSelection() if iFruit == -1{ wx.MessageBox("No fruit to delete!.", "Alert") }if else{ lstBasket.Delete(iFruit) if iFruit == lstBasket.GetCount(): iFruit = iFruit - 1 lstBasket.SetSelection(iFruit) }else }def def FruitBasket_Close(self){ if wx.MessageBox("Exit program?", "Confirm", wx.YES_NO) == wx.YES : dlg.Destroy() }def # Main program app = wx.PySimpleApp() dlg = wx.Dialog(None, -1, "Fruit Basket") sizer = wx.FlexGridSizer(cols=3, hgap=6, vgap=8) lblFruit = wx.StaticText(dlg, -1, "&Fruit:") sizer.Add(lblFruit) txtFruit = wx.TextCtrl(dlg) sizer.Add(txtFruit) btnAdd = wx.Button(dlg, -1, "&Add") sizer.Add(btnAdd) lblBasket = wx.StaticText(dlg, -1, "&Basket:") sizer.Add(lblBasket) lstBasket = wx.ListBox(dlg) sizer.Add(lstBasket) btnDelete = wx.Button(dlg, -1, "&Delete") sizer.Add(btnDelete) btnAdd.SetDefault() dlg.Bind(wx.EVT_BUTTON, Add_Click, btnAdd) dlg.Bind(wx.EVT_BUTTON, Delete_Click, btnDelete) dlg.Bind(wx.EVT_CLOSE, FruitBasket_Close, dlg) dlg.SetSizerAndFit(sizer) dlg.Show() app.MainLoop() # End of py_fruit.pyb # Begin content of py_fruit.py # Fruit Basket program in PyDent with WxWidgets # Public domain by Jamal Mazrui import wx def Add_Click(self): sFruit = txtFruit.GetValue() if len(sFruit ) == 0: wx.MessageBox("No fruit to add!", "Alert") #if else: lstBasket.Append(sFruit) iFruit = lstBasket.GetCount() - 1 lstBasket.SetSelection(iFruit) txtFruit.Clear() #else #def def Delete_Click(self): iFruit = lstBasket.GetSelection() if iFruit == -1: wx.MessageBox("No fruit to delete!.", "Alert") #if else: lstBasket.Delete(iFruit) if iFruit == lstBasket.GetCount(): iFruit = iFruit - 1 lstBasket.SetSelection(iFruit) #else #def def FruitBasket_Close(self): if wx.MessageBox("Exit program?", "Confirm", wx.YES_NO) == wx.YES : dlg.Destroy() #def # Main program app = wx.PySimpleApp() dlg = wx.Dialog(None, -1, "Fruit Basket") sizer = wx.FlexGridSizer(cols=3, hgap=6, vgap=8) lblFruit = wx.StaticText(dlg, -1, "&Fruit:") sizer.Add(lblFruit) txtFruit = wx.TextCtrl(dlg) sizer.Add(txtFruit) btnAdd = wx.Button(dlg, -1, "&Add") sizer.Add(btnAdd) lblBasket = wx.StaticText(dlg, -1, "&Basket:") sizer.Add(lblBasket) lstBasket = wx.ListBox(dlg) sizer.Add(lstBasket) btnDelete = wx.Button(dlg, -1, "&Delete") sizer.Add(btnDelete) btnAdd.SetDefault() dlg.Bind(wx.EVT_BUTTON, Add_Click, btnAdd) dlg.Bind(wx.EVT_BUTTON, Delete_Click, btnDelete) dlg.Bind(wx.EVT_CLOSE, FruitBasket_Close, dlg) dlg.SetSizerAndFit(sizer) dlg.Show() app.MainLoop() # End of py_fruit.py __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind