I found out that , in Python, a backslash character, preceded by a space, can be placed at the end of a line to indicate that the statement continues on the next line. Also, a semicolon can be used to seperate statements on the same line. Jamal On Mon, 17 Dec 2007, Octavian Rasnita wrote: > Date: Mon, 17 Dec 2007 17:19:33 +0200 > From: Octavian Rasnita <orasnita@xxxxxxxxx> > Reply-To: programmingblind@xxxxxxxxxxxxx > To: programmingblind@xxxxxxxxxxxxx > Subject: Re: Minimal fruit basket program with PyBrace > > Maybe it would be helpful to also specify where the line end, using a > semicolon for this. > > It is not nice at all to not be able to split an expression on more lines. > > Otherwise... WxPython is pretty nice, because it allows that hash-syntax of > specifying the function parameters, like > sizer = wx.FlexGridSizer(cols = 3, hgap = 6, vgap = 8) > > ...unlike WxPerl, that wrapped Wx Widgets to have a syntax very similar to > the code in C. > > Octavian > > ----- Original Message ----- > From: "Jamal Mazrui" <empower@xxxxxxxxx> > To: <programmingblind@xxxxxxxxxxxxx> > Sent: Monday, December 17, 2007 4:29 PM > Subject: Re: Minimal fruit basket program with PyBrace > > > > After reading more wxPython documentation, here is a more concise and > > readable set of PyBrace and PyDent versions. > > > > Jamal > > > > # Fruit Basket program in PyBrace with WxWidgets > > # Public domain by Jamal Mazrui > > > > import wx > > > > def Add_Click(event){ > > sFruit = txtFruit.GetValue() > > if len(sFruit ) == 0: return wx.MessageBox("No fruit to add!", "Alert") > > > > lstBasket.Append(sFruit) > > iFruit = lstBasket.GetCount() - 1 > > lstBasket.SetSelection(iFruit) > > txtFruit.Clear() > > }def > > > > def Delete_Click(event){ > > iFruit = lstBasket.GetSelection() > > if iFruit == -1: return wx.MessageBox("No fruit to delete!.", "Alert") > > > > lstBasket.Delete(iFruit) > > if iFruit == lstBasket.GetCount(): iFruit -= 1 > > lstBasket.SetSelection(iFruit) > > }def > > > > def FruitBasket_Close(event){ > > if wx.MessageBox("Exit program?", "Confirm", wx.YES_NO) == wx.YES : > > dlg.Destroy() > > }def > > > > # Main program > > app = wx.App() > > dlg = wx.Dialog(parent = None, title = "Fruit Basket") > > sizer = wx.FlexGridSizer(cols = 3, hgap = 6, vgap = 8) > > lblFruit = wx.StaticText(parent = dlg, label = "&Fruit:") > > sizer.Add(lblFruit) > > txtFruit = wx.TextCtrl(parent = dlg) > > sizer.Add(txtFruit) > > btnAdd = wx.Button(parent = dlg, label = "&Add") > > sizer.Add(btnAdd) > > lblBasket = wx.StaticText(parent = dlg, label = "&Basket:") > > sizer.Add(lblBasket) > > lstBasket = wx.ListBox(parent = dlg) > > sizer.Add(lstBasket) > > btnDelete = wx.Button(parent = dlg, label = "&Delete") > > sizer.Add(btnDelete) > > > > btnAdd.SetDefault() > > btnAdd.Bind(wx.EVT_BUTTON, Add_Click) > > btnDelete.Bind(wx.EVT_BUTTON, Delete_Click) > > dlg.Bind(wx.EVT_CLOSE, FruitBasket_Close) > > > > dlg.SetSizerAndFit(sizer) > > dlg.Show() > > app.MainLoop() > > > > # Fruit Basket program in PyDent with WxWidgets > > # Public domain by Jamal Mazrui > > > > import wx > > > > def Add_Click(event): > > sFruit = txtFruit.GetValue() > > if len(sFruit ) == 0: return wx.MessageBox("No fruit to add!", > > "Alert") > > > > lstBasket.Append(sFruit) > > iFruit = lstBasket.GetCount() - 1 > > lstBasket.SetSelection(iFruit) > > txtFruit.Clear() > > #def > > > > def Delete_Click(event): > > iFruit = lstBasket.GetSelection() > > if iFruit == -1: return wx.MessageBox("No fruit to delete!.", > > "Alert") > > > > lstBasket.Delete(iFruit) > > if iFruit == lstBasket.GetCount(): iFruit -= 1 > > lstBasket.SetSelection(iFruit) > > #def > > > > def FruitBasket_Close(event): > > if wx.MessageBox("Exit program?", "Confirm", wx.YES_NO) == wx.YES > > : dlg.Destroy() > > #def > > > > # Main program > > app = wx.App() > > dlg = wx.Dialog(parent = None, title = "Fruit Basket") > > sizer = wx.FlexGridSizer(cols = 3, hgap = 6, vgap = 8) > > lblFruit = wx.StaticText(parent = dlg, label = "&Fruit:") > > sizer.Add(lblFruit) > > txtFruit = wx.TextCtrl(parent = dlg) > > sizer.Add(txtFruit) > > btnAdd = wx.Button(parent = dlg, label = "&Add") > > sizer.Add(btnAdd) > > lblBasket = wx.StaticText(parent = dlg, label = "&Basket:") > > sizer.Add(lblBasket) > > lstBasket = wx.ListBox(parent = dlg) > > sizer.Add(lstBasket) > > btnDelete = wx.Button(parent = dlg, label = "&Delete") > > sizer.Add(btnDelete) > > > > btnAdd.SetDefault() > > btnAdd.Bind(wx.EVT_BUTTON, Add_Click) > > btnDelete.Bind(wx.EVT_BUTTON, Delete_Click) > > dlg.Bind(wx.EVT_CLOSE, FruitBasket_Close) > > > > dlg.SetSizerAndFit(sizer) > > dlg.Show() > > app.MainLoop() > > > > __________ > > View the list's information and change your settings at > > //www.freelists.org/list/programmingblind > > > > __________ > View the list's information and change your settings at > //www.freelists.org/list/programmingblind > __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind