Oops... I thought I was sending my previous and somewhat cryptic message to Jamal alone.
On Apr 11, 2009, at 12:55 AM, Jamal Mazrui wrote:
From the archive http://EmpowermentZone.com/pynet_fruit.zip This fruit basket program is written in Python 2.5, available at http://python.org with the Python.NET package, available at http://pythonnet.sourceforge.net and an executable builder available at http://py2exe.orgPython.NET gives traditional Python for Windows programs access to much ofthe .NET Framework class library, including the System.Windows.Formsnamespace. It is different from IronPython, which is a .NET language withPython syntax. Source code for this program is in the file pynet_fruit.py, and alsopasted below. It is used to build the Windows executable pynet_fruit.exe,using the batch file RunSetup.bat and script setup.py. The executablerequires three additional files to run: clr.pyd, Python.Runtime.dll, andpython25.dll. Also included in this archive are files from a conference presentation about Python.NET. Jamal """ Fruit Basket program in Python.NET Public domain by Jamal Mazrui April 11, 2009 """ # Import namespaces import clr from System.Windows.Forms import * # Define Add event handler def HandleAdd(sender, event): sFruit = txtFruit.Text if len(sFruit) == 0: return MessageBox.Show('No fruit to add!', 'Alert') lstBasket.Items.Add(sFruit) txtFruit.Clear() lstBasket.SelectedIndex = lstBasket.Items.Count - 1 # Define Delete event handler def HandleDelete(sender, event): iFruit = lstBasket.SelectedIndex if iFruit == -1: return MessageBox.Show('No fruit to delete.', 'Alert') lstBasket.Items.RemoveAt(iFruit) if iFruit == lstBasket.Items.Count: iFruit -= 1 if iFruit >= 0: lstBasket.SelectedIndex = iFruit # Create controls lblFruit = Label() lblFruit.Text='&Fruit:' txtFruit = TextBox() btnAdd = Button() btnAdd.Text='&Add' btnAdd.Click += HandleAdd lblBasket = Label() lblBasket.Text='&Basket:' lstBasket = ListBox() btnDelete = Button() btnDelete.Text='&Delete' btnDelete.Click += HandleDelete tlp = TableLayoutPanel() tlp.ColumnCount=3 tlp.RowCount=2tlp.Controls.AddRange((lblFruit, txtFruit, btnAdd, lblBasket, lstBasket,btnDelete)) # Finalize dialog dlg = Form() dlg.Text='Fruit Basket' dlg.AcceptButton=btnAdd dlg.StartPosition=FormStartPosition.CenterScreen dlg.AutoSize=True dlg.AutoSizeMode=AutoSizeMode.GrowAndShrink dlg.Controls.Add(tlp) dlg.ShowDialog() __________ 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