Re: Fruit basket program in Boo

  • From: "inthaneelf" <inthaneelf@xxxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 20 Oct 2007 10:26:01 -0700

well I can send you the fbd's in both for you to compare if you would like?

the iron python one is up on the fruit basket demo site, and I have the boo one here. or you can use Jamal's link and the one on the fb site and get them yourself, besides, smile that's why there being made available, so one can compare them.

take care,
. For Blind Programming assistance, Information, Useful Programs, and Links to Jamal Mazrui's Text tutorial packages and Applications, visit me at:
. to be able to view a simple programming project in several programming languages, visit the Fruit basket demo site at:

----- Original Message ----- From: "rrdinger" <rrdinger@xxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Saturday, October 20, 2007 7:31 AM
Subject: Re: Fruit basket program in Boo

How does BOO compare with Iron Python? Other than the static typing vs dynamic typing.


----- Original Message ----- From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Friday, October 19, 2007 8:22 PM
Subject: Fruit basket program in Boo

From the zip archive at

This fruit basket program is written in Boo  -- Full source code in the
zip archive and pasted below.  The batch file compile.bat invokes the
command-line compiler for this scripting language.  The resulting
executable, boo_fruit.exe, is about 12K in size.  No other files are
needed to run the program -- as long as the .NET Framework 2.0 is

Boo borrows syntax from Python, seeks to improve it, and combine strengths
of both static and dynamic languages.  Its home page is at
Boo resources, including the interpreter, compiler, documentation, and
examples are available from there.

I am still learning Boo, but was able to produce a working program by
converting the first C# fruit basket program I did via a web form
available at
For comparison, the C# code is available in the file cs_fruit.cs.


content of
Fruit Basket program in Boo
Public domain by Jamal Mazrui

namespace MyNamespace

import System.Windows.Forms

// define class inherited from Form
public class MyForm(System.Windows.Forms.Form):

private lblFruit as Label

private txtFruit as TextBox

private lblBasket as Label

private lbBasket as ListBox

private btnAdd as Button

private btnDelete as Button

public def constructor():
// define constructor
// set window title
self.Text = 'Fruit Basket'
//this.Width = 328;
self.Width = 400
self.Height = 285

// create two rows of controls with three controls in each
// label, textbox, button and label, listbox, button
lblFruit = Label()
lblFruit.Text = '&Fruit:'
lblFruit.Left = 14
lblFruit.Top = 14
lblFruit.Width = 44
lblFruit.Height = 16

txtFruit = TextBox()
txtFruit.Left = 64
txtFruit.Top = 14
txtFruit.Width = 200
txtFruit.Height = 16

btnAdd = Button()
btnAdd.Text = '&Add'
btnAdd.Left = 272
btnAdd.Top = 14
btnAdd.Width = 100
btnAdd.Height = 20
//  make it the default button
self.AcceptButton = btnAdd
btnAdd.Click += self.OnAddClick

lblBasket = Label()
lblBasket.Text = '&Basket:'
lblBasket.Left = 14
lblBasket.Top = 38
lblBasket.Width = 44
lblBasket.Height = 16

lbBasket = ListBox()
lbBasket.Left = 64
lbBasket.Top = 38
lbBasket.Width = 200
lbBasket.Height = 200

btnDelete = Button()
btnDelete.Text = '&Delete'
btnDelete.Left = 272
btnDelete.Top = 38
btnDelete.Width = 100
btnDelete.Height = 20
btnDelete.Click += self.OnDeleteClick

// add controls to form

// center form on screen
self.StartPosition = FormStartPosition.CenterScreen

// define event handlers for add and delete buttons
protected def OnAddClick(sender as object, e as System.EventArgs):
sFruit as string
sFruit = txtFruit.Text
if sFruit == '':
MessageBox.Show('No fruit to add.', 'Alert')
txtFruit.Text = ''
lbBasket.SelectedIndex = (lbBasket.Items.Count -

protected def OnDeleteClick(sender as object, e as
iFruit as int
iFruit = lbBasket.SelectedIndex
if iFruit == (-1):
MessageBox.Show('No fruit to delete.', 'Alert')
if iFruit > (lbBasket.Items.Count - 1):
iFruit = (lbBasket.Items.Count - 1)
lbBasket.SelectedIndex = iFruit

// define main entry point of application
public static def Main():


//End of program

View the list's information and change your settings at

View the list's information and change your settings at //

View the list's information and change your settings at //

Other related posts: