Friday, March 13, 2009

Displaying List of Strings from C and Python

The C function tc_getFromList , or the equivalent python function pytc.getFromList allows C and Python programs to display either a list or a drop-down menu. When the user makes a selection, the index of the selection will be returned.

The following command generated the above dialog.

pytc.getFromList("What will you have for dinner?",("fruits and nuts", "bowl of cereal", "pasta and veggies", "sandwich", "oats and nuts"),0)


Changing the last argument will change the display to a drop-down menu (combo box), as shown below.

pytc.getFromList("What will you have for dinner?",("fruits and nuts", "bowl of cereal", "pasta and veggies", "sandwich", "oats and nuts"),1)



No comments: